Find your content:

Search form

You are here

Salesforce Single Object Approval Processes run separately

 
Share

I want to have a number of different approval processes run off Opportunities for things like discount approval, credit check and a compliance check. Is there a way I can set these up as separate processes in the Approval Process area but run them separately using a custom button or something similar without them being dependent on each other?

From my understanding, you can only run the process and it will take the first one that passes the entry criteria.


Attribution to: Kris Moyse

Possible Suggestion/Solution #1

Nope.

Even from Apex code you (I'm simplifying a bit, full example here) you just call "Approval process engine, grab this record and have a look which approval flow it matches". It's a "first come, first served" thing - the order in which you've listed Approvals for given object and their entry criteria DOES matter.

You could submit it to multiple approvers at the same time and require them all to give it a go (search the help for "unanimous approval"). But that's still a limitation if you want multi-step approvals (everybody on level 1 would have to agree...).

Is this really what you want though - even if it would be possible opportunity would be locked until all requests have been approved/rejected...

You could try making your own approval process, it's not exactly rocket science. Make a small custom object in master-detail relationship to opportunity, call it "Approval Process" with field "Type" and submit these? Some cross-object workflow rule, rollup-summary field, trigger that would set a flag or simply a "Submit them all" button could take care of setting some hidden flag on Opportunity that says it's in middle of approval process... Furthermore (with more triggers) you could analyze who's current approver and whether you let him make changes to the Opportunity or not).


Attribution to: eyescream

Possible Suggestion/Solution #2

To start with, it is easy to set them up as Independent approval processes, and yes you're right that it enters the first process whose entry criteria it meets.

You could have a picklist which choses the type of approval process the user wants to sumit to and save it on the record. The standard Submit for Approval button would do. (If a not null value in this field is an entry criteria for all approval processes, the user would not be able to Submit it for approval without first selecting a value)

If you needed to have different buttons (not desirable), the custom Submit for Approval button click could invoke some code to (using JS via the AJAX toolkit) set this value on this field.You can then submit the record for approval via the standard URL, I.e. redirecting it to eg "/p/process/Submit?retURL=%2F{!Opportunity.Id}&id={!Opportunity.Id}"; for Opportunity

The custom field is used to filter on in the entry criteria of the various approval processes.

So if the ApprovalType = Credit Check, it enters the Credit Check Approval Process, because the entry criteria validates this condition.

In summary, while you cannot run them in parallel, you can choose which one to run at a given time, and run them sequentially.


Attribution to: techtrekker

Possible Suggestion/Solution #3

Technically an approval process applies to the entire object and that's why the object typically gets locked: the person approving should be certain that they are reviewing the same state which was submitted and not something changed in between.

What you describe is pretty well field approval which is probably best done either with:

  • your own pseudo-approval process on the Opportunity OR
  • child objects

Enter the Think Tank...

If you have to use approval processes and wanted to re-use the same object you could even make a single dummy child object called FieldApprove__c with just Name, Value__c and Status__c fields.

You would then make 2 or 3 custom buttons go to one OpportunitySubmit VF page which creates the child objects and submits them for approval.

So, on the opportunity page a "Submit for Credit Control" button would launch your OpportunitySubmit page with ?type=CC&id={!Opportunity.Id} and your VF Controller would create a new FieldApprove__c child object on that Opportunity and would immediately submit it for approval. Your approval process would set it's status to SUBMITTED and then APPROVED once approved.

Finally you would have a trigger on the FieldApprove__c object which caught the APPROVED status and updated the opportunity. Could also be done with a workflow.

Phew!


Attribution to: Marc
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/3896

My Block Status

My Block Content