Preview and Submit Approvals
11 min
this guide covers the read then submit half of the approvals api finding the applicable process, previewing the approval path, submitting a record, and recalling it if it needs to change list approval processes returns the approval processes configured for an object, in the order the approval engine evaluates them get /cpq/approval processes parameter type description objecttype string object to list processes for, for example quote required unless recordid is supplied recordid string derives the object from a record and returns only processes applicable to that record activeonly boolean return only active processes curl x get 'https //api nue io/cpq/approval processes?objecttype=quote\&activeonly=true' \\ h 'nue api key your api key' { "status" "success", "data" { "objecttype" "quote", "processes" \[ { "processname" "standard discount approval", "objecttype" "quote", "versionnumber" 3, "isactive" true, "processorder" 1, "applieswhen" "discount greater than 15%", "description" "routes discounted quotes to the deal desk and above" } ] }, "warnings" \[], "errors" \[] } supply recordid instead of objecttype when you want only the processes that actually apply to one record preview the approval path returns the routing a record would follow if it were submitted right now nothing is written — you can call this as often as you like post /cpq/approvals\ preview field type description recordid string required the record to preview processname string omit to let the engine resolve the applicable process curl x post 'https //api nue io/cpq/approvals\ preview' \\ h 'nue api key your api key' \\ h 'content type application/json' \\ d '{ "recordid" "0q0kb000000xyzakak" }' { "status" "success", "data" { "recordid" "0q0kb000000xyzakak", "requiresapproval" true, "resolvedprocessname" "standard discount approval", "paths" \[ { "pathid" "a0rkb000000txabmak", "pathname" "discount over 15%", "willtrigger" true, "dependsonpathid" null, "steps" \[ { "stepid" "a0skb000000uvbcmak", "stepname" "deal desk", "stepstatus" null, "triggerreason" "discount is 22%, threshold is 15%", "approvalreason" "discount approved by deal desk", "resolveon" "allapprovers", "numberofapprovers" 1, "dependsonstepid" null, "isremembered" false, "approvers" \[ { "approvertype" "user", "userid" "005kb000000wxyziak", "name" "dana reyes", "grouporrolename" null } ] } ] } ] }, "warnings" \[], "errors" \[] } three fields carry most of the value requiresapproval — false when no configured path applies use it to skip the approval step entirely rather than submitting and discovering nothing happened willtrigger on each path, with triggerreason — tells you why a path applies, in terms you can show a rep approvers on each step — the people who will actually be asked, resolved from users, groups, or roles preview is the cheapest guardrail you can build because it persists nothing, you can call preview on every quote save surfacing "this discount needs vp sign off" while the rep is still editing is far cheaper than discovering it after submission submit for approval submits a record into its approval process the record is locked according to the process configuration post /cpq/approvals\ submit field type description recordid string required the record being submitted processname string omit to let the engine resolve the applicable process submittedmessage string comment recorded on the submission source string ui , email , api , or flow defaults to api curl x post 'https //api nue io/cpq/approvals\ submit' \\ h 'nue api key your api key' \\ h 'content type application/json' \\ d '{ "recordid" "0q0kb000000xyzakak", "submittedmessage" "discount approved by regional director on the call", "source" "api" }' { "status" "success", "data" { "requestid" "a0tkb000000vwcdmak", "recordid" "0q0kb000000xyzakak", "status" "pending", "islocked" true, "approvers" \[ { "approvalid" "a0ukb000000wxdemak", "stepname" "deal desk", "stepstatus" "pending", "approveruserid" "005kb000000wxyziak", "originalapproveruserid" null, "reassignedfromapprovalid" null, "rejectionmessage" null } ], "approvals" \[] }, "warnings" \[], "errors" \[] } islocked tells you whether the record is now read only reflect it in your ui so a rep isn't offered an edit that will fail recall a submission pulls a submitted record back out of its approval process so it can be edited again, unlocking it and revoking the outstanding approvals post /cpq/approvals\ recall field type description recordid string required the record whose submission is being recalled processname string omit to let the engine resolve the applicable process actor string salesforce user id to act on behalf of source string ui , email , api , or flow defaults to api curl x post 'https //api nue io/cpq/approvals\ recall' \\ h 'nue api key your api key' \\ h 'content type application/json' \\ d '{ "recordid" "0q0kb000000xyzakak" }' recall is the supported way to correct a quote mid approval editing around a locked record leaves the approval history inconsistent with what was actually approved