Skip to main content
Conga Support

Use a Salesforce Attachment as a Conga Template

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."

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.

Create a SOQL Query to retrieve the attachment(s). The query will look something like this:


FROM Attachment

WHERE ParentId = '{pv0}'

Reference this query via its ID using the &QVar0Id (Query Variable) parameter. For example:


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:


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 in situations where more than one attachment may be retrieved.








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