function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Help with junction object with lookup to user. How to ensure standard user object has Business Unit info?

Best way to handle many - many relationship between User & Business Unit. One user can belong to many business units & a business unit can be associated with several users.

Soln: Create junction object with lookup to standard user object & lookup to custom Business Unit object which captures the business units.

Concern with soln: User needs to be maintained in the custom junction object as well as the standard user object. I would prefer a solution where once user is added / deleted with Business unit info the junction object should be automatically updated.In my solution the standard user object does not capture business unit information (because of many-many relationship). The link with business unit and user is made in the junction object. This means the user in the user object is not linked with the business unit. The solution seems clunky. Any suggestions on how this can be accomplished?
You can use a process builder, create a process which creates new data or update existing in junction object when you add or update data in other object.
Could you elaborate on the process builder? Is there a process builder included with sales force? How can I access it? I imagine you refer to some kind of workflow tool? Also do you think the relationship between user and junction object should be master detail?
You can find it in Create->Workflow & Approvals->Process Builder
It is similar to workflow, but more powerful, much closer to triggers. 
BTW you can also write a trigger if you familiar with apex.

Also do you think the relationship between user and junction object should be master detail?
Actually yes, no reason to keep data in junction object if this data doesnt connected to parent object and will give you opportunity to get aumatically data in reports and rollup summary data.