With this API, you can submit an approval context with comments JSON. 

APISignature
submitForApprovalsWithCommentswebService static Boolean submitForApprovalsWithCommentsJSON(String sObjectType, Id sObjectId, String commentsJSON)
Request Parameters
NameTypeRequired?Description

sObjectId

IDYesID of the approval context object.

sObjectType

StringYesType of the approval context object.
commentsJSONStringYesA JSON representation of the SubmissionComments object.
Response Parameter
NameTypeDescription
resultBooleanReturns true if the API is executed successfully.

Code Sample

The sample below enables you to set process and step level comments.

// create process level submission comments JSON structure
SubmissionComments commentsInfo = new SubmissionComments();
commentsInfo.commentsLevel = SubmissionComments.PROCESS_LEVEL_COMMENTS;
commentsInfo.commentsCount = 1;
commentsInfo.processName = 'ProcessName';
commentsInfo.processCommentLabel = 'ProcessLabel';
commentsInfo.processCommentMandatory = false;
commentsInfo.processComment = 'Here is my comment';
		
String submitCommentsJSON = commentsInfo.toJSON();
/* submitCommentsJSON =
{
  "stepCommentList" : [],
    "processName" : "ProcessName",
    "processCommentMandatory" : false,
    "processCommentLabel" : "ProcessLabel",
    "processComment" : "Here is my comment",
    "commentsLevel" : "Process",
    "commentsCount" : 1
}
*/	
//  get JSON representation for submission comments
String submitCommentsJSON = commentsInfo.toJSON();
// submit with comments
ApprovalsWebService.submitForApprovalsWithCommentsJSON(SObjectConstants.SOBJECT_TYPE_AGREEMENT, 'a013l00000sR4iPAAS', submitCommentsJSON);	




// create step level submission comments JSON structure
SubmissionComments commentsInfo = new SubmissionComments();
commentsInfo.commentsLevel = SubmissionComments.STEP_LEVEL_COMMENTS;
commentsInfo.commentsCount = 3;
// create step comment
SubmissionComments.StepComment stepComment1 = new SubmissionComments.StepComment();
stepComment1.stepName = 'User Assignee';
stepComment1.stepCommentLabel = 'GS_Business_Justification';
stepComment1.stepComment = 'This is comment 1';
commentsInfo.addStepComment(stepComment1);
// create step comment
SubmissionComments.StepComment stepComment2 = new SubmissionComments.StepComment();
stepComment2.stepName = 'Queue Assignee';
stepComment2.stepCommentLabel = 'GS_Deal_Strategy';
stepComment2.stepComment = 'This is comment 2';
commentsInfo.addStepComment(stepComment2);
// create step comment
SubmissionComments.StepComment stepComment3 = new SubmissionComments.StepComment();
stepComment3.stepName = 'Role Assignee';
stepComment3.stepCommentLabel = 'GS_Supporting_Information';
stepComment3.stepComment = 'This is comment 3';
commentsInfo.addStepComment(stepComment3);

/* submitCommentsJSON = 
{
  "stepCommentList" : [ {
    "stepName" : "User Assignee",
    "stepCommentLabel" : "GS_Business_Justification",
    "stepComment" : "This is comment 1"
  }, {
    "stepName" : "Queue Assignee",
    "stepCommentLabel" : "GS_Deal_Strategy",
    "stepComment" : "This is comment 2"
  }, {
    "stepName" : "Role Assignee",
    "stepCommentLabel" : "GS_Supporting_Information",
    "stepComment" : "This is comment 3"
  } ],
  "processName" : null,
  "processCommentMandatory" : false,
  "processCommentLabel" : null,
  "processComment" : null,
  "commentsLevel" : "Step",
  "commentsCount" : 3
}
*/	
//  get JSON representation for submission comments
String submitCommentsJSON = commentsInfo.toJSON();
// submit with comments
ApprovalsWebService.submitForApprovalsWithCommentsJSON(SObjectConstants.SOBJECT_TYPE_AGREEMENT, 'a013l00000sR4iPAAS', submitCommentsJSON);
CODE

Integration Details

Use the following information in your integrations with Apttus Intelligent Workflow Approvals API. Refer to Integrating Apttus 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">
   <soapenv:Header>      
      <app:SessionHeader>
         <app:sessionId>00DR0000001nyVR!ARYAQNCIk5WB9S9PlmZzS2uecBjxnhB20ndYmyxseH1LEfStQi1cXAtXiDxEyd3kAbYrAXbpJmDZzVXGxrxxleE8Fmm6kqSm</app:sessionId>
      </app:SessionHeader>
      </soapenv:Header>
   <soapenv:Body>
      <app:submitForApprovalsWithCommentsJSON>
         <app:sObjectType>Apttus__APTS_Agreement__C</app:sObjectType>
         <app:sObjectId>a07R000000AiYlwIAF</app:sObjectId>
         <app:commentsJSON>{
  "stepCommentList" : [],
    "processName" : "ProcessName",
    "processCommentMandatory" : false,
    "processCommentLabel" : "ProcessLabel",
    "processComment" : "Here is my comment",
    "commentsLevel" : "Process",
    "commentsCount" : 1
}</app:commentsJSON>
      </app:submitForApprovalsWithCommentsJSON>
   </soapenv:Body>
</soapenv:Envelope>
XML

Example Response

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns="http://soap.sforce.com/schemas/class/Apttus_Approval/ApprovalsWebService">
   <soapenv:Body>
      <submitForApprovalsWithCommentsJSONResponse>
         <result>true</result>
      </submitForApprovalsWithCommentsJSONResponse>
   </soapenv:Body>
</soapenv:Envelope>
XML