Enabling Auto-Reapproval on Proposal and Proposal Line Items
This API takes several parameters and updates the reapproval data in the process instance so that proposal line items can be automatically reapproved when resubmitted after finalizing new items in the cart. This API is available in the base Approvals package.
API |
Signature |
---|---|
updateApprovalData |
webService static Boolean updateApprovalData(Id instanceId, String sObjectType, Id contextObjId, List oldContextObjIds, List newContextObjIds) |
Request Parameters | |||
---|---|---|---|
Name |
Type |
Required? |
Description |
instanceId |
ID |
Yes |
The process instance ID currently running in the system |
sObjectType |
String |
Yes |
The sObject type used to identify the object type |
contextObjId |
|
Yes |
The ID of the context object |
oldContextObjIds |
List<ID>oldContextObjIds |
Yes |
The list of approval data context object IDs to be replaced |
newContextObjIds |
List<ID> newContextObjIds |
Yes |
The list of new approval data context object IDs |
Response Parameter | |||
---|---|---|---|
Name |
Type |
Required |
Description |
Ok |
Boolean |
Yes |
Defines if the operation was successful. Returns true if yes, otherwise false. |
Code Sample
The sample below enables you to execute auto-reapprovals over proposal line items by considering input parameters such as process instance, sObject type, context object, and lists of old and new context object IDs. These IDs represent the proposal line-item IDs before and after the cart is finalized. You can use this API, for example, when a quote or proposal is approved but the approvals manager changes the discount from 10 to 15% on a proposal line item. You can resubmit the approval request for reapproval. The system honors the auto-reapproval criteria, using which, a request once approved by certain assignees is auto-approved.