As a Salesforce professional, you understand the importance of having accurate and up-to-date information readily available in order to make informed decisions. With Conga Composer, you can easily merge data from Salesforce to create complex, branded documents in a variety of formats, including Excel, Word, and PDFs.
However, one challenge with using Conga is that batching records and automating business processes can be difficult with this tool. But don't worry, there is a solution! By using Apex, you can merge and create documents without ever touching the record in the UI. This opens up a world of possibilities for automating document creation, such as sending receipts to customers or automatically sending contracts based on opportunity stage.
Today, we'll explore how to set up this automation using a template. We'll walk you through a simple example of creating a custom email that is sent when an opportunity reaches the "Closed Won" stage. The email includes a PDF document that is generated from a merge of the opportunity and contact data.
Prerequisites
- Conga Composer 8
- Salesforce Admin Permissions
- (Optional) Org-Wide Email Address
Remote Site Setup
You will need to create a remote site for the composer api. You can do this using the following setup:
name: Composer_API
url: https://composer.congamerge.com
Custom Metadata
We'll be using a custom metadata object to hold information about the email. This allows end users to update data without having to make changes to the code in the sandbox. The custom metadata object includes fields for the body of the email, the file name, the subject, and the template ID.
To create the custom metadata:
Label: Composer Automation
Plural Label: Composer Automations
Object Name: Composer_Automation
And the necessary custom fields:
- Body - Long Text Area(32768)
- File Name - Text(255)
- Include Date - Checkbox
- Org Wide Email - Email
- Subject - Text(255)
- Template Id - Text(255)
We'll use the custom meatadata to drive the settings for the email and content functionality. This way code updates are not needed if a simple title update is needs.
Apex Code
The sample code supplied is an example of how to merge documents using apex. You can find the full source code in the github repository
Conclusion
In conclusion, Conga Composer is a powerful tool for creating complex documents in Salesforce. With the ability to automate document creation using Apex, you can streamline your processes and improve the accuracy of your data. If you want to learn more about using Apex to automate document creation in Salesforce, check out the links below.
G2 Technologies: Learn more about how G2 Technologies can help you improve and automate your Salesforce instances.