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
NameTypeDescriptionRequired?
ParentIdIDThe 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
DocFileNameStringName of the packaged document file (.doc or .docx).Yes
ProtectionLevelStringProtection level of the document generated.Yes
AddWatermarkBooleanIndicates whether to add a watermark to the document.Yes
RemoveWatermarkBooleanIndicates whether to remove a watermark from the document.Yes
AddAutoHeaderFooterBoolean

Indicates whether to use the configured header and footer format located in Comply System Properties.

  • If AddAutoHeaderFooter=true, the API uses the Comply System Properties defined for header and footer data.
  • If AddAutoHeaderFooter=false, the API uses values from the headerText and footerText parameters.
Yes
HeaderTextStringText to include in the document header.Yes
FooterTextStringText to include in the document footer.Yes
PreserveRedlinesBooleanIndicates whether the redlines in the input document will be preserved/ accepted in the packaged document. The default value is false.Yes
SessionIdIDThe Session ID to use for callback.Yes
SessionUrlStringThe Server URL to use for callback.Yes
RetainInputHeaderFooterBooleanIndicates whether the merged document retains the existing header and footer of the original documents and page numbers are cumulative.Optional
CumulativePageNumberBooleanIndicates 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.

ScenarioRetainInputHeaderFooterCumulativePageNumberAddAutoHeaderFooterResult
Documents with header and footerTrueTrueFalse
  • The existing header and footer of the documents are retained.
  • The default footer is not added as the RetainInputHeaderFooter parameter is set to True.
Documents without header and footerTrueTrueFalse
  • The default footer is not added as the RetainInputHeaderFooter parameter is set to True.
Documents with header and footerFalseTrueFalse
  • The existing header and footer of the documents are removed.
  • The default footer is inserted and the footer has cumulative page numbers. 
Documents without header and footerFalseTrueFalse
  • The default footer is inserted and the footer has cumulative page numbers. 
Documents with header and footerTrueFalseFalse
  • The existing header and footer of the documents are retained.
  • The default footer is not added as the RetainInputHeaderFooter parameter is set to True.
Documents without header and footerTrueFalseFalse
  • The existing header and footer of the documents are retained.
  • The default footer is not added as the RetainInputHeaderFooter parameter is set to True.
Documents with header and footerFalseFalseTrue
  • The existing header and footer of the documents are removed.
  • The header and footer are inserted with the default page number format.
Documents without header and footerFalseFalseTrue
  • The existing header and footer of the documents are removed.
  • The header and footer are inserted with the default page number format.



Response Parameter
NameTypeDescription
resultIDReturns 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);
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 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>
XML

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>
XML