Contact Us menu-bars menu-close

Hack of the Day: Simplified Document Merging with Conga & Visualforce


Twinkle Panjabi

September 07, 2015

We have all gone through the phase of writing an impressive resume and applying for jobs. Did we ever think how tiring it is for the recruitment teams in these companies to download our attached resume and consolidate the information within into their HR systems or merge it? Probably not. But it is, and that’s where we Salesforce developers come to their rescue!

Recently, I had a requirement to merge information from the attached documents using Conga, where I needed to configure Conga through a Visualforce page. I needed to pass multiple IDs through the Conga button to generate attachment corresponding to those IDs. At first I was skeptical because the integration of Conga with Visualforce and Apex (or other programming languages) is not supported owing to the complex nature of supporting programmers and programming languages. But I was ready to scale my Everest, no matter what. My goal was simple: pass a set of IDs to customize the magical button which would give me the merged document/attachment with the related data. Before we see how I did that, let me quickly introduce Conga to you.

Conga Composer: Merging Data for a Simple Life!

Conga is a fantastic tool for merging data from Salesforce to a predefined word document template. It provides you a document with arranged and formatted, sophisticated-looking data. As an icing on the cake, you have the option to choose various data formats:  Word, Excel, PowerPoint, HTML, email & PDF, depending on your requirement.

Required Flow of Events

In my case, the user needed to navigate to the Requisition Tab. Once there, the user then needed to Click on the record. Once he would click on the View Candidate Button, he would be able to see multiple candidates related to the requisition.

The user would need to Select the candidates whose resume he wished to merge or review, and then click on the Conga button.


Let me now take you through the 3-step configuration process.

Step 1:
I created a Visualforce Page and an Apex Controller which would fetch all the records related to my requisition ID on the button click from the requisition record, as shown below.

Hack of the Day: Simplified Document Merging with Conga & Visualforce

Step 2:
Once the candidate was selected, the IDs of the respective candidates would pass to the Conga button. To fetch the attachments related to the candidates, I needed to match the SOQL query with the candidate IDs. And what’s better than a conga query?

I traversed to Conga Composer (App) -> Conga Queries(Tab) -> Click New and created the following query.

Hack of the Day: Simplified Document Merging with Conga & Visualforce

Step 3:
Finally, I generated a script to create a dynamic URL for conga composer. Here is the screenshot for the same.

Hack of the Day: Simplified Document Merging with Conga & Visualforce

And we are done! I can hear the recruiters around the world sighing with relief. Yes, we Salesforce developers are an awesome lot!

Hack of the Day: Simplified Document Merging with Conga & Visualforce

Conga is God’s Gift for Document Merging!

  • Merging the documents or consolidating the information from within the attached document into your systems was never so easy before
  • The solution can be applied to both standard and custom objects of Salesforce

Just a little catch…

This solution requires Apex and Visualforce and is not possible to achieve through mere point and click. So, you need to have basic knowledge about Apex and Visualforce development. But hey, that’s what we are there for, right?

A Final word from a Conga fan…

Conga is a great tool for merging documents from various file formats and storing the information within at a centralized location. So go ahead and merge your documents with Conga. Trust me, life was never this simple before.

Get updates. Sign up for our newsletter.


Let's explore how we can create WOW for you!