Auto-Approval in a Multi-Step Salesforce Approval Process

You’ve been tasked with writing an approval process. If an opportunity meets the entry criteria (Stage Name = Pre-Contract) and has an Amount greater than $1000, it needs to be approved by either Bobby or Billy in Sales Management, and if it has an Amount less than or equal to $1000, it needs auto-approval in Salesforce. (We’ll leave the Actions, like field updates, for another discussion.)

That’s easy, you say. (You’re right.) You create an approval process (working in a sandbox, of course) as follows:

  • Name: Opportunity Approval
  • Entry Criteria: StageName = ‘Pre-Contract’
  • Step 1
    • Criteria: Amount > 1000, else approve record
    • Approvers: Bobby or Billy, whoever responds first

You try it out in the sandbox, and it works great, so you deploy it. Everyone’s happy, right?

Everyone’s happy except Susie in Finance, who wants to review and approve opportunities after Bobby or Billy approve them. So you clone the original approval process (because Salesforce won’t let you add a step to an active approval process), and then change it to this:

  • Name: Opportunity Approval
  • Entry Criteria: StageName = ‘Pre-Contract’
  • Step 1
    • Criteria: Amount > 1000, else go to next step
    • Approvers: Bobby or Billy, whoever responds first
  • Step 2
    • Criteria: Amount > 1000, else approve record
    • Approvers: Susie

So if the opp meets the entry criteria and is greater than $1000, Bobby or Billy approve it, then it goes to Susie for approval; and if it’s not greater than $1000, it gets auto-approved. Looks good, right?

Nope. This would work if Step 2 actually had the “else approve record” option, but for reasons that surpass understanding, Salesforce doesn’t give you the “else” option for that step. Try as you might, you can’t get Salesforce to add “else approve record” to Step 2. Without a defined “else” option, what actually happens when the approval process runs is not deterministic: it might auto-approve in the sandbox and auto-reject in Production. (Trust me. I know. I spent a lot of time beating my head against the wall on this one!)

What’s an admin to do?

Turns out (of course), there’s a solution. The solution lies in creating two distinct approval processes, both of which are active at the same time.

Process 1:

  • Name: Opportunity Auto-Approval
  • Entry Criteria: StageName = ‘Pre-Contract’ and Amount <= 1000
  • Step 1
    • Criteria: false, else auto-approve
    • Approvers: doesn’t matter

Process 2:

  • Name: Opportunity Approval v2
  • Entry Criteria: StageName = ‘Pre-Contract’ and Amount > 1000
  • Step 1
    • Criteria: true, else go to next step
    • Approvers: Bobby or Billy, whoever responds first
  • Step 2
    • Criteria: true
    • Approver: Susie

Two active approval processes in for Auto-Approval in Salesforce

Really?!? Yes, you can have two active approval processes for the same object at the same time. Salesforce will run all active approval processes for which the opp meets the entry criteria. If the opp doesn’t meet any of the active processes’ entry criteria, you’ll get the usual “Doesn’t meet entry criteria” error.

Let’s say you have an opp with StageName = Pre-Contract and an Amount of $500. It meets the entry criteria for Process 1, so Process 1 begins. The opp doesn’t meet the criteria for Step 1 (no opp ever will meet that criteria, because it’s false), so it will auto-approve. That’s why it doesn’t matter who you pick as approvers: the opp will never meet the step criteria, so it will never be seen by an approver, so it doesn’t matter who you pick.

That same opp doesn’t meet the entry criteria for Process 2, so that process doesn’t run. There’s no error because the other active process did run.

Now let’s say you have a different opp with StageName = Pre-Contract and an amount of $10,000. It doesn’t meet the criteria for Process 1, so Process 1 doesn’t run. It does meet the criteria for Process 2, so Process 2 sends it first to Bobby or Billy, and if they approve, to Susie. Because the criteria for Step 2 will always be met, you don’t have to worry about the “else” action and the fact that Salesforce doesn’t let you define one.

The lessons learned here? First, if you need to write a multi-step approval process in which auto-approval is an option, you’ll have to create two active approval processes: one for the auto-approval and another for the multiple steps.

Second, you can have multiple active approval processes for the same object. And you can even define the order in which they run.

Third (a little nugget buried above), you can’t add a step to an active approval process. Instead, you have to deactivate the approval process, clone it, and add the step to the clone. (Wondering what happens to any opps that are in the middle of the original approval process? They still follow the original process, even though it’s been deactivated.)

Fourth, although Salesforce’s approval process functionality has some shocking limitations (just try to write an approval process where a lookup field on the opp owner’s User record says who should approve it – you can’t!), there are ways to work around at least some of them. If you need help with more than just auto-approval in Salesforce, we can help you with  your Salesforce needs.

I hope you approve…

MJ Kahn, SVP of Technology at OpFocus

about the author

MJ Kahn

At OpFocus, MJ architects and constructs solutions that would impress the builders of the pyramids. She solves technical puzzles that would frustrate daVinci. She leaps tall buildings (like the new Salesforce tower) in a single bound.

Well ok, maybe she doesn’t. But she does help lead an amazing team of smart, talented, and dedicated consultants who do. MJ’s job at OpFocus is provide technical leadership and guidance to OpFocus clients and team members so that, working together, we can create innovative yet practical solutions to real-world business problems within the Salesforce ecosystem.

Prior to OpFocus, MJ built an extensive background in technology and has held a variety of development, consulting, and management positions at companies like Sybase, Vignette, and Honeywell, among others. In these roles, MJ’s focus was helping companies effectively and intelligently use technology to solve business problems. An Apex and Visualforce consultant since mid-2008, MJ has worked with scores of companies to help them understand and utilize platforms like Force.com to solve business issues and also guide them in developing their own AppExchange product offerings.