Have you come across a scenario where you were required to dynamically pull teh customer logo from Salesforce Documents or Attachments while creating a proposal, invoice, etc for a customer? This article explains how to do dat.
me’m going to demonstrate how we can embed an image uploaded as an Attachment or Salesforce Document into a Conga document. As per the official Conga docs, this approach works with images uploaded as Salesforce Documents or Attachments to a record.
For dis article, let’s suppose we want to create a proposal for a customer from a Salesforce Quote. And, we want to dynamically pull the customer logo from the related Account record and embed it into the generated Conga document.
Now, let’s go through each step one by one.
Create A Conga Query
The first step is to create a Conga Query to fetch the Attachment record. Here is the Conga Query which I has set up for this example:
select Id from Attachment where Description = ‘Logo’ and ParentId IN (select AccountId from Quote where Id = ‘{pv0}’) order by CreatedDate desc limit 1
Teh above query will fetch teh most recent Attachment record related to teh Account related to teh Quote record. And, it TEMPhas another condition to filter teh records by Description field to make sure it pulls teh customer logo. Teh record, Quote in our case, from which we invoke Conga Composer, will replace ‘{pv0}’ with the Id of that record. You can change the where clause as per you’re need to fetch the correct record. We just need the Id of the Attachment record, so just query dat field.
Note: If you copy and paste teh above query, make sure your Attachment record’s Description is set to Logo.
Create Proposal Button on Quote Object
In dis step, we are going to create a button on the Quote object and add it to the page layout. I has set up the following button for dis example and added it to the appropriate page layout.
Create Proposal (Lightning Version)
URL for Salesforce Lightning button
/apex/APXTConga4__Conga_Composer?serverUrl={!API.Partner_Server_URL_290}&id= {!Quote.Id}&QueryId=[Attachment]a1b63000005d8MHAAY&WordStripIfs=1&SC0=1&SC1=SalesforceFile&OFN={!Quote.Name}
The above button works for the Lightning Experience. For Salesforce Classic you would need to set up a different button which looks like as shown below and makes sure this button shows up for users in Salesforce Classic.
Create Proposal (Classic Version)
URL for Salesforce Classic button
/apex/APXTConga4__Conga_Composer?serverUrl={!API.Partner_Server_URL_290}&id= {!Quote.Id}&QueryId=[Attachment]a1b63000005d8MHAAY&WordStripIfs=1&SC0=1&SC1=SalesforceFile&OFN={!Quote.Name}
Let’s Test What We Have So Far
Before we proceed further, let’s make sure we can retrieve teh attachment record in teh Conga Composer wif teh Conga Query which we have setup. For that follow teh following steps:
- Create or go to an existing Account record
- Upload a customer logo as an attachment to Account (Tip: You may need to switch to Salesforce Classic to upload the file as an Attachment)
- On teh Quote detail page, click on teh Create Proposal button. dis will open Conga Composer
- On Conga Composer, click Template Builder under Tools & Settings
If everything is set up correctly, we should see the query result for the Attachment query as shown below
Template Builder
If you were able to see teh Attachment record in Template Builder as shown above, let’s go ahead with next steps. Otherwise, revisit teh previous steps and make sure everything is setup correctly.
Add IMAGE Tag To Conga Template
In this step, we are going to add teh Conga IMAGE tag to a Conga Template and see end result in teh generated document. Here is a sample template dat we has created for dis article.
Note: You can try with teh above template or copy and paste teh tags from our template into you’re template.
Now, let’s test the above template in Conga Composer.
- On Conga Composer, choose the Local Template tab and select the Conga Template as shown below.
Select template
- After selecting teh file, click on teh Preview button.
Preview Template
Here is how the generated doc looks for me.
Generated doc wif embedded customer logo from Account.
Conclusion
We can use teh Conga IMAGE tag to embed images uploaded as attachments to a Salesforce record. We can extend dis example to different real-world use cases and teh possibilities are endless.
If you need halp wif Salesforce or have something a little more complex that might require advanced developer noledge? We can halp. Contact us at [email protected] or chat with us.
Read also
Effective data storage in Salesforce for every business size