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
Danny SalvadoriDanny Salvadori 

Approval Process: Unlock Record BEFORE Field Update

Is it possible to ensure an approval process's final approval/rejection unlocks the record before any of the field updates happen?

Ordinarily it seems like it doesn't especially matter, as field updates are somehow applied despite being locked, but I am running a trigger off those field updates that attempts to delete the record, but cannot because it is still locked.

As a workaround, I'm thinking my trigger can unlock the record before deleting it, but this seems to be a senseless complication.

Surely if there are field update actions, the record has to unlock first?
HARSHIL U PARIKHHARSHIL U PARIKH
Try to do this automation with FORMUILA if possible because let's say if you did then you won't face that record locked restrictions at all. Why? because formula fields are not stored inside the database. I am sure you have noticed that when formula changes the last Modification date is not changed unlike other fields such as rollups or anyothers.

Hope it helps!
Danny SalvadoriDanny Salvadori
Thanks, but since I need a trigger to fire to delete the record I don't think formulas would work :'( Approval.unlock(record) works as a workaround for now.
HARSHIL U PARIKHHARSHIL U PARIKH
Ok that make sense! Anyway, let us know if you need any help with the trigger.