You need to sign in to do that
Don't have an account?
maddukuri
Capturing Approval Steps in the trigger
I have an approval process with multiples steps, say step1 thru step 10. My trigger needs to capture who the approver is at each step and based on the approver perform some functionality. How do I accomplish that in the trigger? Please advise.
Hello maddukuri,
I think you need to write a trigger on the respective object on which the approval process is working ,
and then you need to work wih "Approval.ProcessSubmitRequest" Object please check with following sudo code .
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setComments('Submitted for approval. Please approve.');
req.setObjectId(Trigger.new[i].Id);
// submit the approval request for processing
Approval.ProcessResult result = Approval.process(req);
for more information please check with the following link.
http://www.blog.jeffdouglas.com/2010/01/04/automating-salesforce-approval-processes-with-apex-triggers/
Thanks
Nik's
Thank You Nik! I just want to make sure that I am not trying to rewrite the approval process in the trigger. I need to keep the approval process as it is but in my trigger, based on the approver at each step of the approval process, I need to perform some actions.