Automated Process User Profile Permissions

We are having some difficulty with permissions. Our admin has also posted on the success board. https://success.salesforce.com/answers?id=9063A000000eB7V, she also found this same posting: https://success.salesforce.com/answers?id=9063A000000l9eC I am posting here to see if there are any devs/admins on here that have run into this issue as well.

We have a process that is called from a platform event, which sends a visualforce email template in an email alert. It seems like the Automated Process user, which is the user that triggers the Platform Event, does not have access to the email template’s visualforce controller. Is there any way to give access to the controller to that user?

Answer

I’ve found Matt’s answer on the IdeaExchange

You can follow the recommendation from Roy Lloyd and create a Permission Set and assign the autoproc User in Exec-Anonymous:

insert new PermissionSetAssignment(
    AssigneeId = [SELECT Id FROM User WHERE alias = 'autoproc'].Id,
    PermissionSetId = '<your Permission Set Id here>'
);

You should then be able to manage the Permission Set to add any new permissions you need.


Alternatively, use URL hacking:

Using the Developer Console to query for the autoproc Profile ID:

SELECT ProfileId FROM User WHERE Alias = 'autoproc'

Then use a URL hack to access the setup page and enable the relevant Apex Classes:

/_ui/system/user/ProfileApexClassPermissionEdit/e?profile_id={autoproc_profile_id}

Or to Apex Pages

/_ui/system/user/ProfileApexPagePermissionEdit/e?profile_id={autoproc_profile_id}

Or to Field Level Permissions:

/setup/layout/flsedit.jsp?id={autoproc_profile_id}&type={sObjectName}

Enable Apex Class Access

This resolved the error ‘You do not have sufficient privileges to access the controller’.

Attribution
Source : Link , Question Author : Olivia , Answer Author : Robs

Leave a Comment