Assign a User to another user

So I’m building out a site for a client and the way his company works, each user is assigned a sale representative.

The broad stroke question, how do I assign a user to another user? The sales rep would need to be able to see every client that is assigned to them, and the user should be able to see their sale rep info. I’m blanking on a possible solution.

I’m using the AirDev canvas template to build this out, utilizing the chat section as well with the sales rep/customer.

You can set a field to a type ‘User’

So you just need to have a field ‘clients’ (of type user) which would be list of users for the sale rep (assuming clients are users).

And a field ‘Sales Rep’ (of type ‘User’) which refers to the sales rep of a given user…

Just make sure you link it all together correctly and you’ll be able to access all the data you need as and when you need it.

So in the AirDev Canvas Template, they have their roles set up as an option set and not as a direct field for Users. Within that option set I have the sales rep role, and the standard user role.

I’m just having trouble linking all of it. What would be the workflow of assigning a sales rep to the user (sales reps for this company are assigned by region: north Texas, south Oklahoma, etc)? At least just a general idea of where to start as I can’t seem to wrap my brain around my starting point here.

So as far as how a workflow might go, it would be something along these lines…

Assuming that the sales reps are also users of your app (if they’re not then you’d need to create a new datatype for sales reps)…

First you’d have to sign the user up using a basic signup action.

Next (assuming the sales rep already exists in your database) you’d need to have some way of selecting which sales rep would be assigned to the user (perhaps a dropdown, or a search field, or perhaps it would be set on the page or group that triggers the workflow.

Then simply set the ‘Sales Rep’ field for the new user to be the appropriate sales rep.

If the sales rep doesn’t yet exist in the database, then after creating the new user, you’d need an action to create a sales rep, then set the newly created sales rep to the ‘Sales Rep’ field of the newly created user.

You may also want to link the data in the opposite direction as well - so set (or add) the new user to the sales rep using a different field (it may a be a list, depending on how the relationship between sales reps and users works in your app).