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
Nidish G 6Nidish G 6 

Automated User should bypass Validation Rule just like System Admin

We have a scheduled flow to update owner names for Accounts based on some criteria, the Automated user needs to have syatem admin privilages in order to overcome to Validation rule. So, we are trying to provide permission sets to Automated user.

We got a workaround for this in IdeaExchange portal.

1] Create a permission set and check the required permissions. Let’s say the name of this permission set is ‘Automated_Process’.
2] Assign this permission set by running the script below in anonymous block:=============
PermissionSet permissionSet = [ SELECT Id, Name FROM PermissionSet WHERE Name = ‘Automated_Process’ ]; User automatedUser = [ SELECT Id, Name FROM User WHERE Name = ‘Automated Process’ ]; PermissionSetAssignment pa = new PermissionSetAssignment( PermissionSetId = permissionSet.Id, AssigneeId = automatedUser.Id ); insert pa;

However, even that seems to be not working.

Please help!!

Thank You!!

PriyaPriya (Salesforce Developers) 

Hi Nidish,

Check this to bypass the validation rule :-

https://automationchampion.com/tag/bypass-this-validation-rule-for-the-system-administrator/

https://www.adminwithin.com/post/setting-up-automation-and-validation-rule-bypasses-in-salesforce

regards,

Priya Ranjan