Submitting for Approvals with Comments
With this API, you can submit an approval context with comments.
API |
Signature |
---|---|
submitForApprovalsWithComments |
webService static Boolean submitForApprovalsWithComments(String sObjectType, Id sObjectId, Apttus_Approval.SubmissionComments comments) |
Request Parameters | |||
---|---|---|---|
Name |
Type |
Required? |
Description |
sObjectId | ID |
Yes |
ID of the approval context object. |
sObjectType | String |
Yes |
Type of the approval context object. |
comments | Object |
Yes |
The SubmissionComments object. |
Response Parameter | ||
---|---|---|
Name |
Type |
Description |
result | Boolean |
Returns true if the API is executed successfully. |
Code Sample
// create process level submission comments
SubmissionComments comments = new SubmissionComments();
comments.commentsLevel = SubmissionComments.PROCESS_LEVEL_COMMENTS;
comments.commentsCount = 1;
comments.processName = 'MyProcessName';
comments.processCommentLabel = 'MyProcessLabel';
comments.processCommentMandatory = false;
comments.processComment = 'Here is my submission comment';
// call submit with comments API
Apttus_Approval.ApprovalsWebService.submitForApprovalsWithAttachmentsAndComments('Apttus_APTS_Agreement_c', agmtId, comments);
/**
* Apttus Approvals Management
* SubmissionComments
*
* @2010-2019 Apttus Inc. All rights reserved.
*/
global with sharing class SubmissionComments {
public static final String PROCESS_LEVEL_COMMENTS = 'Process';
public static final String STEP_LEVEL_COMMENTS = 'Step';
// comments level
public String commentsLevel = null;
// comments count
public Integer commentsCount = 1;
// process name
public String processName = null;
// process comments label
public String processCommentLabel = null;
// process comment mandatory
public Boolean processCommentMandatory = false;
// process comments
public String processComment = null;
// step comments list
public List<StepComment> stepCommentList = new List<StepComment>();
/**
* Public constructor
*/
public SubmissionComments() {
}
/**
* Gets process name
*/
global String getProcessName() {
return processName;
}
/**
* Gets process comment label
*/
global String getProcessCommentLabel() {
return processCommentLabel;
}
/**
* Gets process comment
*/
global String getProcessComment() {
return processComment;
}
/**
* Sets process comment
* @param comment
*/
global void setProcessComment(String comment) {
this.processComment = comment;
}
/**
* Is comment at process level?
*/
global Boolean isProcessLevelComment() {
return (PROCESS_LEVEL_COMMENTS == commentsLevel);
}
/**
* Sets process comment to manadatory
*/
global void setProcessCommentMandatory() {
this.processCommentMandatory = true;
}
/**
* Is comment at process level mandatory?
*/
global Boolean isProcessLevelCommentMandatory() {
return processCommentMandatory;
}
/**
* Is comment at step level?
*/
global Boolean isStepLevelComment() {
return (STEP_LEVEL_COMMENTS == commentsLevel);
}
/**
* Get comments count - max of 3 at step-level and 1 at process-level
*/
global Integer getCommentsCount() {
return commentsCount;
}
/**
* Gets step comment list
*/
global List<StepComment> getStepCommentList() {
return stepCommentList;
}
/**
* Add stepComment to list
* @param comment
*/
global void addStepComment(StepComment comment) {
stepCommentList.add(comment);
}
/**
* Creates the json representation of the submission comments
* @return the json string
*/
global String toJSON() {
// get the json representation
return System.JSON.serializePretty(this);
}
/**
* Parses the submission comments object from the given JSON string
* @param jsonString the json string to parse
* @return the submission comments data object
*/
global static SubmissionComments parse(String jsonString) {
// load the class (salesforce class loading bug)
System.Type wrapperType = System.Type.forName(SystemUtil.getFQClassName('SubmissionComments'));
// deserialize the object
return (SubmissionComments) System.Json.deserialize(jsonString, SubmissionComments.class);
}
/**
* Inner class to hold step level comments
*/
global class StepComment {
// step name
public String stepName = null;
// step comment label
public String stepCommentLabel = null;
// step comments
public String stepComment = null;
/**
* Public constructor
*/
public StepComment() {
}
/**
* Gets step name
*/
global String getStepName() {
return stepName;
}
/**
* Gets step comment label
*/
global String getStepCommentLabel() {
return stepCommentLabel;
}
/**
* Gets step comment
*/
global String getStepComment() {
return stepComment;
}
/**
* Set step comment
* @param comment
*/
global void setStepComment(String comment) {
this.stepComment = comment;
}
}
}
Integration Details
Use the following information in your integrations with Conga Approvals API. Refer to Integrating Conga with External Systems 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: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:submitForApprovalsWithComments>
<app:sObjectType>Apttus__APTS_Agreement__c</app:sObjectType>
<app:sObjectId>a07R000000AiYQXIA3</app:sObjectId>
<app:comments>
<sub:commentsCount>1</sub:commentsCount>
<sub:commentsLevel>Process</sub:commentsLevel>
<sub:processComment>Here is my comment</sub:processComment>
<sub:processCommentLabel>ProcessLabel</sub:processCommentLabel>
<sub:processCommentMandatory>false</sub:processCommentMandatory>
<sub:processName>ProcessName</sub:processName>
</app:comments>
</app:submitForApprovalsWithComments>
</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>
<submitForApprovalsWithCommentsResponse>
<result>true</result>
</submitForApprovalsWithCommentsResponse>
</soapenv:Body>
</soapenv:Envelope>