Updated: Aug 8, 2018
Often the native Salesforce approval is not enough for the CPQ approval process as it doesn't cope too well with scenarios where quotes have to be adjusted after the approval.
Also, the CPQ doesn't cope too well with Salesforce native validation rules so it's good to avoid using them on Quote.
In this post we'll be creating a robust and visually pleasing approval process using a mixture of process builder, record types, and the Salesforce native approval functionality. N.b. we're not using the CPQ's add-on "advanced approvals".
No code required
3x record types
3x page layouts
4x custom fields on quote which can be taken off the layouts
1x meaty process builder
1x approval process
1x quick action
(1) Create 3 record types: "Standard" (this is the default), "Requires Approval", and "Approved". Create 3 page layouts of the same name and assign them to their corresponding record types. We'll come back to these later.
(2) Create a standard checkbox on quote: "Approved"
(3) Create a checkbox formula on quote, "Requires Approval". This looks at what your predetermined approval criteria is, e.g. total discount is above a certain $ amount.
For the formula syntax also we're going to say that the "Approved" checkbox <> TRUE.
(4) Create a standard checkbox on quote: "Edit Approved Quote". This will later give the user the ability to recall an unlocked, approved quote.
(5) Create your Process Builder. It is run on the quote object and fires whenever the record is edited. It has 4 stages:
- If ("Quote Line Item Count">0 and "Requires Approval"=TRUE), set the record type to "Requires Approval". You have to hardcode the ID so careful when it comes to deployment.
- If ("Approved"=True and "Edit Approved Quote" = False), set the record type to "Approved"
- If ("Edit Approved Quote" = True and "Approved" = True), set record type to "Requires Approval". Also in your actions, set both "Approved" and "Edit Approved Quote" to false. Optionally, send the quote status back to draft.
- If ("Requires Approval" = False and "Approved" = False), set record type to "Standard".
On Steps 2, 3 and 4 you want to set the execution action like this:
(6) Create your Approval Process:
The only entry criteria is that "Requires Approval" is True.
I'm not doing anything unusual on the approval process. I've added a couple of final approval actions to (a) tick the "Approved" checkbox on quote, and (b) change the record type to "Approved"
See below for exact settings.
(7) Create a text formula field called "Warning". Add the text "Selecting this option could mean that the quote has to be approved again. Proceed if you're happy with this".
(8) Create a Quick Action on Quote called "Edit Approved Opportunity". The action should set the value of the field "Edit Approved Quote" to false.
(9) Adjust the page layouts
The "Standard" layout should have everything.
The "Requires Approval" layout should remove any ability to create or preview documents
The "Approved" layout should get the document stuff back, but lose the ability to edit lines. Also any fields relating to your initial approval criteria should be made read-only via the page layout. Add your Quick Action to this layout so it appears like this:
When your user gets through the approval process and hits the Quick Action, they'll get this screen.
(10) Create a standard user for testing. Make yourself the manager of that user. Login as the user and log yourself in on an incognito window for testing.
Add a quick action in Opportunities for creating quotes which defaults the record type to "standard".
Test to death.