Download PDF
Download page Submitting Bulk Approval Requests.
Submitting Bulk Approval Requests
With this API, you can submit bulk approval requests for review. This API accepts the object type and the object ID of the context object as input parameters. You can also add comments to your approval requests. You cannot submit approval requests with attachments.
If you submit previously submitted or approved approvals as part of bulk approval request, the approval request is submitted again.
This API is useful to submit a large number of approval requests for various context objects. For example, an approvals admin for a data service organization needing to submit all approval records for five agreements in one call can use submiForApprovalsBulk API with the type and IDs of the five agreements as request parameters.
Note
The submitForApprovalsBulk API supports up to 50 context object records. Beyond this limit, Salesforce throws a SOQL error.
API | Signature |
---|---|
submitForApprovalsBulk | webService static Boolean submitForApprovalsBulk(List ctxObjParams) |
Request Parameters | |||
---|---|---|---|
Name | Type | Required? | Description |
ctxObjParams | Object | Yes | Object containing all the approval parameters |
approvalParams | |||
---|---|---|---|
Name | Type | Required? | Description |
approvalObjectId | ID | Yes | ID of the approval context object. |
approvalObjectType | String | Yes | Type of the approval context object. |
approvalCommentsObject | Object | No | The approval comment object |
Response Parameter | ||
---|---|---|
Name | Type | Description |
result | Boolean | Returns true if the API is executed successfully. |
/**
* Apttus Approvals Management
* BulkCtxObjectParam
*
* @2020 Apttus Inc. All rights reserved.
*/
global with sharing class BulkCtxObjectParam {
/**
* Context Object Type
*/
webservice String ctxSObjectType { global get; global set; }
/**
* Context Object Id
*/
webservice ID ctxSObjectId { global get; global set; }
/**
* Submission Comments
*/
webservice SubmissionComments comments { global get; global set; }
/**
* Global Constructor
*/
global BulkCtxObjectParam() {
ctxSObjectType = null;
ctxSObjectId = null;
comments = null;
}
/**
* Creates the json representation of the bulk context objects
* @return the json string
*/
global String toJSON() {
// get the json representation
return System.JSON.serializePretty(this);
}
/**
* Parses the bulk context object param from the given JSON string
* @param jsonString the json string to parse
* @return the bulk context param object
*/
global static BulkCtxObjectParam parse(String jsonString) {
// load the class (salesforce class loading bug)
System.Type wrapperType = System.Type.forName(SystemUtil.getFQClassName('BulkCtxObjectParam'));
// deserialize the object
return (BulkCtxObjectParam) System.Json.deserialize(jsonString, BulkCtxObjectParam.class);
}
}
// multiple context object type and ids
String agmtType = 'Apttus__APTS_Agreement__c';
ID agmtId1 = 'a07R000000APxGG';
ID agmtId2 = 'a07R000000AS9nJ';
ID agmtId3 = 'a07R000000AS9nO';
// submission comments
Apttus_Approval.SubmissionComments submitComments1 = new Apttus_Approval.SubmissionComments();
submitComments1.commentsLevel = Apttus_Approval.SubmissionComments.PROCESS_LEVEL_COMMENTS;
submitComments1.commentsCount = 1;
submitComments1.processName = 'ProcessName';
submitComments1.processCommentLabel = 'ProcessLabel';
submitComments1.processCommentMandatory = false;
submitComments1.processComment = 'Test Comment 1';
Apttus_Approval.SubmissionComments submitComments2 = new Apttus_Approval.SubmissionComments();
submitComments2.commentsLevel = Apttus_Approval.SubmissionComments.PROCESS_LEVEL_COMMENTS;
submitComments2.commentsCount = 1;
submitComments2.processName = 'ProcessName';
submitComments2.processCommentLabel = 'ProcessLabel';
submitComments2.processCommentMandatory = false;
submitComments2.processComment = 'Test Comment 2';
Apttus_Approval.SubmissionComments submitComments3 = null;
// create list of context objects
List<Apttus_Approval.BulkCtxObjectParam> ctxParams = new List<Apttus_Approval.BulkCtxObjectParam>();
Apttus_Approval.BulkCtxObjectParam ctxParam1 = new Apttus_Approval.BulkCtxObjectParam();
ctxParam1.ctxSObjectType = agmtType;
ctxParam1.ctxSObjectId = agmtId1;
ctxParam1.comments = submitComments1;
ctxParams.add(ctxParam1);
Apttus_Approval.BulkCtxObjectParam ctxParam2 = new Apttus_Approval.BulkCtxObjectParam();
ctxParam2.ctxSObjectType = agmtType;
ctxParam2.ctxSObjectId = agmtId2;
ctxParam2.comments = submitComments2;
ctxParams.add(ctxParam2);
Apttus_Approval.BulkCtxObjectParam ctxParam3 = new Apttus_Approval.BulkCtxObjectParam();
ctxParam3.ctxSObjectType = agmtType;
ctxParam3.ctxSObjectId = agmtId3;
ctxParam3.comments = submitComments3;
ctxParams.add(ctxParam3);
// bulk submit
Boolean ok = Apttus_Approval.ApprovalsWebService.submitForApprovalsBulk(ctxParams);
Integration Details
Use the following information in your integrations with Conga Approvals API. Refer to Integrating Conga with External Systems for information on how to get started.
API Prerequisites
None.
Response/Request XML
Example Request
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:app="http://soap.sforce.com/schemas/class/Apttus_Approval/ApprovalsWebService"
xmlns:bul="http://soap.sforce.com/schemas/class/Apttus_Approval/BulkCtxObjectParam"
xmlns:sub="http://soap.sforce.com/schemas/class/Apttus_Approval/SubmissionComments">
<soapenv:Header>
<app:SessionHeader>
<app:sessionId>00DR0000001nyVR!ARYAQOruA8X3nIS2hgZgZxEZkUDHDMlzIfBNGDey8s_.AcTbbEghNGUnMEh5oGcG5mkmrVuHp1F9gHzfIfYAvzuRDU6zg7kO</app:sessionId>
</app:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<app:submitForApprovalsBulk>
<!--Zero or more repetitions:-->
<app:ctxObjParams>
<bul:comments>
<sub:commentsCount>1</sub:commentsCount>
<sub:commentsLevel>Process</sub:commentsLevel>
<sub:processComment>?</sub:processComment>
<sub:processCommentLabel>ProcessLabel</sub:processCommentLabel>
<sub:processCommentMandatory>false</sub:processCommentMandatory>
<sub:processName>ProcessName</sub:processName>
<!--Zero or more repetitions:-->
<sub:stepCommentList>
</sub:stepCommentList>
</bul:comments>
<bul:ctxSObjectId>a07R000000AiYQX</bul:ctxSObjectId>
<bul:ctxSObjectType>Apttus__APTS_Agreement__c</bul:ctxSObjectType>
</app:ctxObjParams>
<app:ctxObjParams>
<bul:comments />
<bul:ctxSObjectId>a07R000000Aj68Y</bul:ctxSObjectId>
<bul:ctxSObjectType>Apttus__APTS_Agreement__c</bul:ctxSObjectType>
</app:ctxObjParams>
</app:submitForApprovalsBulk>
</soapenv:Body>
</soapenv:Envelope>
Example Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/Apttus_Approval/ApprovalsWebService">
<soapenv:Body>
<submitForApprovalsBulkResponse>
<result>true</result>
</submitForApprovalsBulkResponse>
</soapenv:Body>
</soapenv:Envelope>