You can use any of the following Merge Webservice APIs to merge multiple documents into a single PDF. Choose the API that best suits your needs (note limitations for each):

  • mergeDocsToPDF
  • mergeDocsToPDF2
  • createPDF

API

Signature

mergeDocsToPDF

webService static Id mergeDocsToPDF(Id parentId, List docIds, String docFileName, String sessionId, String serverUrl)

This API merges multiple documents using the values specified in the docIds parameter into a single PDF document with the name docFileName.

Request Parameters

Name

Type

Description

Required?

parentId

ID

The id of the parent object to associate with the result document.

Yes

docIds

List

A collection of the ids of the documents to merge into a PDF document.

Yes

docFileName

String

The file name for the PDF document.

Yes

sessionId

String

The Salesforce session id.

Yes

serverUrl

String

The Salesforce server id.

Yes

Note

You cannot use Apttus-generated PDFs with document protection enabled as input documents.

Response Parameter
NameTypeDescription
resultIDThe id of the generated document.

Note

Footers in the final PDF will always list the original filename of the input document for the collated page.

Code Sample

ID parentId = '0016100000KvBHi'
ID[] docIds = new ID[]{'a0Y61000002K6IR','a0Y61000003K7jR'};
String docFileName = 'Agreement-Merged.pdf';
String sessionId = sessionId; 
String serverUrl = System.Url.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/u/14.0/' + UserInfo.getOrganizationId();
ID docId = Apttus.MergeWebService.mergeDocsToPDF(parentId,docIds,docFileName,sessionId,serverUrl);
CODE

Integration Details

Use the following information in your integrations with Apttus Contract Management Web Services API. For information on how to get started, refer to Integrating Apttus with External Systems.

API Prerequisites

None.

Request/Response XML

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mer="http://soap.sforce.com/schemas/class/Apttus/MergeWebService">
   <soapenv:Header>
      <mer:SessionHeader>
         <mer:sessionId>00D0S0000000Pa8!ARUAQGAA1VTGcAG1zxylmAb1RJmiUnspuO5dzL53Xsx3jVhYI3oWTqB2dqzdBeswmwj_I49aI6BgIM4veO1At3rLd9z6BjXv</mer:sessionId>
      </mer:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <mer:mergeDocsToPDF>
         <mer:parentId>a070S000002bSFzQAM</mer:parentId>
         <mer:docIds>0690S000000SvnfQAC</mer:docIds>
         <mer:docIds>0690S000000SvnkQAC</mer:docIds>
         <mer:docFileName>Merged.PDF</mer:docFileName>
         <mer:sessionId>00D0S0000000Pa8!ARUAQGAA1VTGcAG1zxylmAb1RJmiUnspuO5dzL53Xsx3jVhYI3oWTqB2dqzdBeswmwj_I49aI6BgIM4veO1At3rLd9z6BjXv</mer:sessionId>
         <mer:serverUrl>https://testmanagedclm--tbox.my.salesforce.com/services/Soap/u/49.0/00D0S0000000Pa8</mer:serverUrl>
      </mer:mergeDocsToPDF>
   </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/MergeWebService">
   <soapenv:Body>
      <mergeDocsToPDFResponse>
         <result>0690S000000SvwcQAC</result>
      </mergeDocsToPDFResponse>
   </soapenv:Body>
</soapenv:Envelope>
XML