Skip to main content

I'm curious if anyone has had success temporarily assigning & then revoking custom permissions for users. 

 

We have a custom commission calculator built in that runs after every opportunity is closed. In order to do this the user needs access to the custom objects temporarily in order to read & create records, both for themselves & for another user (we use opportunity splits & run the calculator for each person on the split). The ideal order of operations would be:

1. User closes opportunity

2. Runtime permission is assigned

3. Commissions calculated

4. Runtime permission revoked

 

It is possible to assign permission sets to users in a flow as long as that's the only object you're creating/deleting on. However, it seems that the system does not permit you to update setup objects & standard objects in the same transaction. 

 

Flow Debug returns the following error: 

Error Occurred: This error occurred when the flow tried to create records: MIXED_DML_OPERATION: DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa):

 

Has anyone found a successful work around for this?

2 respuestas