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
Roma89Roma89 

Updating other objects records when user role has changed

Is there a way to update a a custom field on an standard or custom object when the "User" object role has changed?  I don't see the option to do workflow rules based on Users in SFDC.

 

Example: We have a custom field in our Case object that pulls the role from the user record of the person who owns the case. However, we noticed when the person who owns the case, changed their role in the "User" object, the custom field stil maintained his old role in custom field we created to track the role of the owner.

 

I think someone once told me you can't do triggers on User records.

Ispita_NavatarIspita_Navatar
Work-flow rules are not allowed for user object and though trigger are allowed on User object it doesn't allow what is called "Mixed DML statements" that is updating setup object from a a non-setup object. So what you can do is perhaps build a settings tab which will house a visual force page which will have a button say "Synchronize" which on click will check if there has been any change in the role of a user based on some flags you may set on the user object via a trigger (as you will be able to update the user object in the trigger) and then make the necessary changes in the related case object.