When a user is created , a process builder is fired and it assign different roles and permissions to the users.

The first decision is to assign the support ticket user . Next decision node is to assign the report folder manager to the user. This is done from an apex class which is called from the process builder.

I am getting an error

unable to The flow tried to update these records: null. This error occurred: UNKNOWN_EXCEPTION: group membership operation already in progress

This is happening because the first step (assigning the support ticket user ) is placing a lock on the record.

Is it possible to find out if the record is locked or not from the apex class?

Is it possible to check if one decision element is completed and record is unlocked before proceeding to next decision in the process builder?

Thank you

1 Answer 1


The lock you're experiencing isn't an Approval Process lock, or anything like that. The share tables are locked because you're updating shares. You need to either change the order in which you update the records such that the shares are created later, or delay updating sharing until after everything else is done with a Wait element or Apex future method.

  • 1
    Inside the apex class, (in the beginning of the class) is it possible to check if the records are locked or not. If it is not locked then only proceed with apex class else if the records are unlocked continue with the apex class. I am not able to reproduce this error in sandbox because this happens only if there are a lot of records.The error is happening only in PROD. Thank you
    – sfdc dan
    Mar 9, 2021 at 20:40
  • 1
    @sfdcdan You can use FOR UPDATE to attempt to acquire a lock, with a try-catch wrapped around it so you can wait on locks for a period of time.
    – sfdcfox
    Mar 9, 2021 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.