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

Faking an Approval

Hi There,


Before asking my question I need to give a bit of background.


I have set up an approval process on Opportunities that doesn't use the built in locking. Instead I set a flag on the opportunity and I have a trigger preventing any more updates.


The reason I am doing this, is that I need to let users amend opportunities after they have been approved. If the user chooses to make a change, then approval is revoked and must be resubmitted. (I cannot see any way to do this with the built-in process).


So, now I have a trigger that allows the user to uncheck the 'locked' flag but in the process also removes authorisation. This all works fine.


However, for cosmetic completeness I would like to add a record to the Approval related list, so the user isn't confused why the last approval history shows Approved when it's actually not.


How can I add a record to that list? Ideally it would say that Approval was either rejected or revoked and a comment to explain.


Any ideas?