You need to sign in to do that
Don't have an account?
Can a pending approval step be completed with Apex
I am using an approval process and field updates to integrate with an external system. I would like to keep an approval step open when information is sent to an external system and then approve the pending step when the external system updates a field. Upon approval, the process proceeds to the next step. With this process, the users can clearly see which approvals are pending in the external system.
Here's my process:
Approval Step 1: User submits for approval on Step 1. If approved, Field 1 is updated and the process goes to Approval Step 2.
Trigger 1: When Field 1 is updated, in simple terms, a process is called from an external system.
Approval Step 2: When workflow is complete in the external system, Field 2 is updated from the external system.
I would like the update of Field 2 to close the pending approval on Step 2. Can I close the pending approval step 2 with a trigger? Any suggestions or recommendations on how to accomplish this step would be appreciated.
Approval Step 3: Continues with the standard user-based approval process.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_example.htm
Thanks for the reply and link to the code. I was hoping to get inside the approval steps; however, it does not look like this is possible (the table info cannot be updated). I'll have to re-work my approval process to close the first approval process when the information is submitted to the external system, and then kick off a new approval process with Apex when the information is transferred back from the external system. I'll accomplish the same goal...just a little work-around. Thanks.