Given
Critical Update Require User Access to Apex Classes Invoked by Flow is activated
Apex trigger that subscribes to a Platform Event
- Trigger logic does DML
- Process Builder executes and makes Invocable Apex call
When
- Running user = Automated Process (as of V46, by definition)
Then
Flow blows up with
Require User Access to Apex Classes Invoked by Flow
But there's no way to assign the Automated Process
user's Profile to any Apex class nor can you assign a Permission Set to Automated Process
user
e.g.
insert new PermissionSetAssignment(
AssigneeId = [select id from User where name = 'Automated Process'][0].Id,
PermissionSetId = [select id from PermissionSet
where name = 'Classes_Automated_Process_User_Needs'][0].Id);
System.DmlException: Insert failed. First exception on row 0; first error:
FIELD_INTEGRITY_EXCEPTION, Can't assign permission set to this user,
user license doesn't match: []
Is there another way to assign Automated Process user to a Permission Set or give it access to this invocable apex class?
Critical Update auto-activates 2019-11-30