Track Field History on User Object Using Before-Save Flow

Use Case: To store old values of user profile and role on User object every time those values are changed.

Solution:

Step 1: Create a Field User History of Type Rich Text Area on User Object.

Step 2: Create Record-Triggered Flow.

Select User Object.

Step 3: Use Decision element to specify outcomes.

Create first outcome as below.

Create second outcome as below.

Create third outcome as below.

Step 4: Create formula, to display old profile and role values along with user who modified and modified date.


'<tr><td style="border: 1px solid black;">Old Profile Value - ' + {!$Record__Prior.Profile.Name} + 
'</th><td style="border: 1px solid black;"> Old Role Value - ' + {!$Record__Prior.UserRole.Name} + 
'</th><td style="border: 1px solid black;"> Modified By - ' + {!$User.FirstName}+ ' ' +{!$User.LastName}+
'</th><td style="border: 1px solid black;"> Modified Date - ' + Text(NOW() )+ 
'</th></tr>'

Step 5: Create a formula, to display old profile value.

Step 6: Create a formula, to display old role value.

Step 7: Use Assignment element to add old profile and role values [formula created in step 4] to user history field on user object [the field created in step 1]

Step 8: Use Assignment element to add old profile value to user history field on user object.

Step 9: Use Assignment element to add old role value to user history field on user object.

Final flow should look like below.

Output:

Thought of displaying prior values in table format was from Narender Singh’s blog post.

Things to consider: Rich Text Area Field Limitations and this solution is not feasible for reporting on user history.

Please feel free to upvote the idea for standard field history tracking on user object.

Thanks for reading…


Leave a comment

Design a site like this with WordPress.com
Get started