Include Salesforce Files in a Conga Composer Merge

Include Salesforce Files in a Conga Composer Merge

Use files with conga mailmerge

Are you using Salesforce Files to store documents?

Are you using Conga Composer to create complex mail merges in Salesforce?

Did you know you can pull files from a related object into your Conga Composer button with a nested SOQL query?

Use case: You are an organization that runs programs from various grants you receive. You track the grant received as an opportunity (grant amount) and you track every program participant on a custom object called Program Participation, which is related to the opportunity record. Each participant must submit an agreement and waiver, which you upload on the Salesforce Files section for each program participation record.
Your grant writer needs one PDF file consolidating the agreements and waivers of every program participant for a $100,000 grant awarded. Thus, you need to create a mail merge from an Opportunity record where you also merge in Salesforce Files from each related Program Participation record.
To pull the files of each Program Participation record, write a SOQL query in Conga Queries to pull the Salesforce File Ids of those records:

SELECT ContentDocument.Id FROM ContentDocumentLink WHERE LinkedEntityId IN
(SELECT Id FROM Program_Participation WHERE Opportunity = ‘{pv0}’) ORDER BY ContentDocument.Title ASC

When programming your Conga button, add the above query ID as the {QVAR0} record id:

https://composer.congamerge.com
?sessionId={!API.Session_ID}
&serverUrl={!API.Partner_Server_URL_290}
&id={!Opportunity.Id}

&QVar0ID=id of query record you just created above
&TemplateID=primary conga templateID,{QVar0}
&define other parameters hereafter

*replace above bolded values with your custom object’s API values and actual salesforce ids.

Voil√°! You just wrote a nested SOQL statement and successfully programmed a button to pull in any and all uploaded Salesforce Files from each Program Participation record into the master merge document for that opportunity record. In other words, you just created a document that pulls in all the agreements and waivers from each participant of the program funded by that $100,000 grant.
Want to see this in action? Give us a call and we’ll give you a quick demo.
Other post covering the replacement of Attachment with Salesforce Files.