Download PDF
Download page Package Multiple Documents.
Package Multiple Documents
This API can be used to package multiple documents (such as a Quote and Agreement document) together into a single merged DOCX document. Implementation requires creation of a custom Visualforce page to make use of the API for document packing purposes.
API | Signature |
---|---|
createWordPackage | webService static Id createWordPackage(Apttus.CustomClass.ActionParams params) |
Request Parameters | |||
---|---|---|---|
Name | Type | Description | Required? |
ParentId | ID | The ID of the parent object associated with the result. | Yes |
Attachments | List<Apttus.CustomClass.AttachmentInfo> | List of all documents in the order to be packaged. | Yes |
ExternalLinks | List<Apttus.CustomClass.ExternalLink> | List of external links to be embedded in document. (not currently supported) | Yes |
DocFileName | String | Name of the packaged document file (.doc or .docx). | Yes |
ProtectionLevel | String | Protection level of the document generated. | Yes |
AddWatermark | Boolean | Indicates whether to add a watermark to the document. | Yes |
RemoveWatermark | Boolean | Indicates whether to remove a watermark from the document. | Yes |
AddAutoHeaderFooter | Boolean | Indicates whether to use the configured header and footer format located in Comply System Properties.
| Yes |
HeaderText | String | Text to include in the document header. | Yes |
FooterText | String | Text to include in the document footer. | Yes |
PreserveRedlines | Boolean | Indicates whether the redlines in the input document will be preserved/ accepted in the packaged document. The default value is false. | Yes |
SessionId | ID | The Session ID to use for callback. | Yes |
SessionUrl | String | The Server URL to use for callback. | Yes |
RetainInputHeaderFooter | Boolean | Indicates whether the merged document retains the existing header and footer of the original documents and page numbers are cumulative. | Optional |
CumulativePageNumber | Boolean | Indicates whether the merged document page numbers are cumulative. | Optional |
Header text will always be right-aligned and footer text will always be left-aligned by default. Also, any page numbers in the input documents will not be present in the final combined document.
When RetainInputHeaderFooter is set to True, the remaining parameters (CumulativePageNumber, and AddAutoHeaderFooter) are not evaluated. When CumulativePageNumber is set to True, the combined document has cumulative page numbers. When AddAutoHeaderFooter is set to True, then the header and footer are inserted according to the input provided. The following table provides a combination of inputs and their results.
Scenario | RetainInputHeaderFooter | CumulativePageNumber | AddAutoHeaderFooter | Result |
---|---|---|---|---|
Documents with header and footer | True | True | False |
|
Documents without header and footer | True | True | False |
|
Documents with header and footer | False | True | False |
|
Documents without header and footer | False | True | False |
|
Documents with header and footer | True | False | False |
|
Documents without header and footer | True | False | False |
|
Documents with header and footer | False | False | True |
|
Documents without header and footer | False | False | True |
|
Response Parameter | ||
---|---|---|
Name | Type | Description |
result | ID | Returns the ID of the merged DOCX document. |
Code Sample
// attachments
List<Apttus.CustomClass.AttachmentInfo> attachments = new List<Apttus.CustomClass.AttachmentInfo>();
Apttus.CustomClass.AttachmentInfo attInfo = new Apttus.CustomClass.AttachmentInfo();
attInfo.Title = 'Agreement-1';
attInfo.RecordId = attSO.Id;
attachments.add(attInfo);
Apttus.CustomClass.AttachmentInfo attInfo2 = new Apttus.CustomClass.AttachmentInfo();
attInfo2.Title = 'Agreement-2';
attInfo2.RecordId = attSO2.Id;
attachments.add(attInfo);
// external links (not supported)
List<Apttus.CustomClass.ExternalLink> links = new List<Apttus.CustomClass.ExternalLink>();
Apttus.CustomClass.ExternalLink linkInfo = new Apttus.CustomClass.ExternalLink();
linkInfo.Title = 'Drawing-1';
linkInfo.Url = 'https://drive.google.com/doc1.docx';
links.add(linkInfo);
Apttus.CustomClass.ExternalLink linkInfo2 = new Apttus.CustomClass.ExternalLink();
linkInfo2.Title = 'Drawing-2';
linkInfo2.Url = 'https://drive.google.com/doc2.docx';
links.add(linkInfo2);
// create action parameters
Apttus.CustomClass.ActionParams params = new Apttus.CustomClass.ActionParams();
params.ParentId = agreementSO.Id;
params.Attachments = attachments;
params.ExternalLinks = links;
params.AddAutoHeaderFooter = true;
params.ProtectionLevel = AgreementProtection.LEVEL_FULL_ACCESS;
params.DocFileName = 'Agreement-Merged.docx';
params.AddWatermark = true;
params.RemoveWatermark = false;
params.HeaderText = 'Agreement Id: 0123456789';
params.FooterText = 'Date Created: 11/27/2011 7:23:15 PM';
params.PreserveRedlines = true;
params.SessionId = ServerInfo.getSessionId();
params.SessionUrl = ServerInfo.getServerUrl();
params.RetainInputHeaderFooter = true;
params.CumulativePageNumber = true;
ID docId = Apttus.MergeWebService.createWordPackage(params);
System.debug('Merged Doc ID=' + docId);
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 Conga CLM 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" xmlns:cus="http://soap.sforce.com/schemas/class/Apttus/CustomClass">
<soapenv:Header>
<mer:SessionHeader>
<mer:sessionId>00D0S0000000Pa8!ARUAQJ53E09loYXezDoz9WVOJugDkLwI58ibwr3Iefz8bY7_HNQ5j3jV302ejFtvD2n1wEI_VL_78sOCL76iVZ5ywpCZaAJs</mer:sessionId>
</mer:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<mer:createWordPackage>
<mer:params>
<cus:AddAutoHeaderFooter>True</cus:AddAutoHeaderFooter>
<cus:AddFooter>False</cus:AddFooter>
<cus:AddHeader>False</cus:AddHeader>
<cus:AddWatermark>False</cus:AddWatermark>
<cus:Attachments>
<cus:RecordId>0690S000000SxbRQAS</cus:RecordId>
<cus:Title>Test_DemoTemplate-KK_2020-07-17_1.0.0.doc</cus:Title>
</cus:Attachments>
<cus:Attachments>
<cus:RecordId>0690S000000SxYhQAK</cus:RecordId>
<cus:Title>Test_00AJ_Template with Clause_2020-07-17_1.0.0.doc</cus:Title>
</cus:Attachments>
<cus:CumulativePageNumber>True</cus:CumulativePageNumber>
<cus:DocFileName>Package.docx</cus:DocFileName>
<cus:FooterText>Copyright 2020</cus:FooterText>
<cus:HeaderText>Apttus</cus:HeaderText>
<cus:ParentId>a070S000002bVP7QAM</cus:ParentId>
<cus:PreserveRedlines>False</cus:PreserveRedlines>
<cus:ProtectionLevel>Full Access</cus:ProtectionLevel>
<cus:ProtectOutputDoc>True</cus:ProtectOutputDoc>
<cus:RemoveWatermark>False</cus:RemoveWatermark>
<cus:RetainInputHeaderFooter>True</cus:RetainInputHeaderFooter>
<cus:SessionId>00D0S0000000Pa8!ARUAQJ53E09loYXezDoz9WVOJugDkLwI58ibwr3Iefz8bY7_HNQ5j3jV302ejFtvD2n1wEI_VL_78sOCL76iVZ5ywpCZaAJs</cus:SessionId>
<cus:SessionUrl>https://testmanagedclm--tbox.my.salesforce.com/services/Soap/u/50.0/00D0S0000000Pa8</cus:SessionUrl>
</mer:params>
</mer:createWordPackage>
</soapenv:Body>
</soapenv:Envelope>
Example Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/Apttus/MergeWebService">
<soapenv:Body>
<createWordPackageResponse>
<result>0690S000000T1GIQA0</result>
</createWordPackageResponse>
</soapenv:Body>
</soapenv:Envelope>