Option Sets and Autobinding

Hi all,

I’m trying to create a CRM to help local businesses that feel Salesforce is just too broad for their needs. That being the case, I need to add multiple companies, with multiple users at each company. However, I need to make sure my users can only access the data members of their company have saved to the database. That being said, I was thinking I could do this by adding a company name to the user data type and a separate company data type while defining privacy rules that say “When Current User’s Company is This Company’s Name.” However, I have become concerned that this could create an issue if users make a typo while inputting their company name. To avoid typos, I figured I could make an option set for all the companies that join and allow users to just select their company from the dropdown box. But to keep everything fully automated, I wanted to auto-bind new company names to the option set so they automatically add the new company when one is created. Is there a way to do this? Am I overthinking it, and is there an easier way? What do you guys think?

Hey @hullaustinj :wave:

I can understand what you are trying to do. It doesn’t have to be that complicated though.

When a user signs up you are creating a Company and then attaching the Company to the User dataType right?

That’s all you need. You just need to use privacy rules that say, “When Current User’s Company is This Company

If it doesn’t turn blue, that means your dataType fields are not set up correctly. You are saving the Current User’s Company as a TEXT when it should be a Company.

Does that make sense?

1 Like

Who will add the companies?

Thinking that in this case the name of the company will be extremely relevant data both for connecting users of the same company and for filtering and displaying data, it would not be advisable to let the companies be registered by the users themselves, since any error in typing or using different characters could generate more than one record for the same company.

It would be advisable for companies to be pre-registered by the application’s admin or by the company’s admin. In this way, it would be advisable to have a data type to store the companies (name and other infos) and then, when registering the users, they selected the available companies through a dropdown, for example, and then, when the registration was finished, this user would be saved in a new data type that has a field linking it to the company (not text).

And that connection with the company must exist in all other data types that you store users data.

Regarding the approach where the company’s admin registers the company, it would also be interesting for him to even perform a pre-registration of users, such as an email, for example. This would prevent any person from registering pretending to be a company user. If there is no pre-registration for him, then he is not a company user.

1 Like

Thanks guys, I guess I was overthinking it. I appreciate the responses.

1 Like