In addition to pre-selecting a Conga Template, Conga Composer can also gather attachments from the Notes and Attachments object related to the master object from which you are running your Conga Composer solution. This is helpful if there are additional documents that should be included with your merged document. To learn more about this process please review this Conga Blog post under number 2, "Using a Salesforce Attachment as a Conga Template."

Important

The Composer Lightning component does not support it.

For example, you may want Conga Composer to generate a proposal document from an Opportunity record but also need to include the Terms and Conditions document that is stored as an attachment (under Notes and Attachments) on the Opportunity.

  1. Are you still using Notes and Attachments? If so, create a SOQL Query to retrieve the attachment(s) that looks like this: SELECT Id FROM Attachment WHERE ParentId = '{pv0}'
    Have you switched to Salesforce files? Use this query: SELECT ContentDocument.id FROM ContentDocumentLink WHERE LinkedEntityId = '{pv0}'
  2. Next, reference this query via its ID using the &QVar0Id (Query Variable) parameter.
    For example: &QVar0ID=a0Ai0000009jpZH
  3. The SOQL Query from Step 1 will return the ID of the attachment, which we now have available in the Conga Composer button URL to use as a variable in another parameter, &AttachmentID. Reference the Query Variable, as {QVar0}, as the value for the &TemplateID parameter.
    For example: &TemplateID=a0Bi000000MrkC8,{QVar0}

Below is an example of what your button URL might look like when the &QVar0Id and &TemplateID parameters are added.

In this example, {!Account.Id} is being passed into the pv0 filter of the query in order to retrieve the attachment(s) from the Account record related to the Opportunity. Furthermore, we're using the &QVar0Format parameter to format the output of the results retrieved in the Qvar0 query; this is necessary for situations where more than one attachment may be retrieved.

https://composer.congamerge.com?sessionId={!API.Session_ID}
&serverUrl={!API.Partner_Server_URL_290}
&id={!Opportunity.Id}
&QVar0ID=a0Ai0000009jpZH
&TemplateID=a0Bi000000MrkC8,{QVar0}
&QVar0Format=10010
&DefaultPDF=1

The above method is supported by both TemplateID and AttachmentID. AttachmentID will simply append the file. TemplateID will process the file.