Clean Printable Views in Salesforce Using Conga Composer
I am a huge fan of Conga Composer. Like many say, "it's like mail merge on steroids". I wanted to share a super-duper easy button for creating a clean, printable view of a record in Salesforce.
I had a request for a custom button on Activities that would give a clean printable view of an activity, like an email. Outside sales people like to print stuff like this before heading out to a meeting. This was perfect for Conga. Here is how it's done.
Create a new custom button. They will be mostly printing emails so I created a new custom Task button. To do this, go to...
Setup -> Customize -> Activities -> Task Buttons and Links
From here, create a new custom button. Make the button and Detail Page Button and adjust the window open settings to the following
- Width: 300 (Note: You might want to make this 450 in the beginning while testing the returned data)
- Height: 150 (Note: You might want to make this 300 in the beginning for the same reasons)
- Uncheck all checkboxes
Now we need to code the button. I ususally like to us an On-Click Javascript button, but for simplicity sake, I'll create a URL button.
You'll want to become familiar with the Introduction to Pointmerge documentation for Conga Composer. Your merge operations will consist of a URL string with many parameters. You can tell Conga what you want merged, what data to use, how you want it merged, where you want it saved, if you want it emailed, etc.
First we need to create a template though. There are different instructions for the different types of documents you can use for merging. I'm not going to get into the details template creation today, besides, its pretty straightforward as the Conga documentation is pretty good.
First, you will need to actually create a button to get a sample of the data it returns. To do that, set the URL in your new button to the following.
https://www.appextremes.com/apps/Conga/PointMerge.aspx
?SessionId={!API.Session_ID}
&ServerUrl={!API.Partner_Server_URL_80}
&Id={!Task.Id}
Now do this...
- Save the button
- Add it to your page layout
- Go to an existing task record. A completed Email task is good
- Click your button
A popup window will appear. You want to look for a small link that says View Data. This is your example data that is available for merging into the document. The column headers in this excel workbook will be the merge field names you will use. Create your merge fields using these values. Below is the template I created in Word to merge the data from the Task record.
Now, I'll show you the final version of the URL string I created for the custom button. I added a bunch of parameters to add some automation to the merge. Take a look and I'll break it down for you.
https://www.appextremes.com/apps/Conga/PointMerge.aspx
?SessionId={!API.Session_ID}
&ServerUrl={!API.Partner_Server_URL_80}
&Id={!Task.Id}
&TemplateId=a1wA00000009W6s
&DefaultPDF=1
&FP0=1
&DS0=1
&DS4=1
&DS7=3
&PS0=1
&PS1=1
The first two lines contain the Conga API endpoint where the merge operation takes place, and passes it your session Id and API URL to authenticate you. If your license or trial is valid, you should have no issues.
The following lines break down like this:
- ID: This is the "Master" record that will be used in the merge operation. The data from this record will be available for your merged document
- TemplateId: This is the Id of the pre-built template we will be using. In this case, it is a word document. We have this stored in the Conga Template manager which is free to download if you are a Conga subscriber. You can also store your merge templates where normal mail merge documents are stored.
- DefaultPDF=1: This says that I want the document rendered as a PDF and makes PDF the default
- FP0=1: This locks the merge to PDF format only
- DS0=1: This disables the controls. Normally, the user can change stuff about the merge operation when the window pops up. I am preventing this to eliminate confusion and get the user to the merged document faster.
- DS4=1: This locks the template choices to the one that I set above.
- Ds7=3: This enables "background mode" and merges everything automatically without the user having to click through the menus. The "3" tells the system what background mode to use. In this case, "3" just delivers this to the browser. I could have changes this value and had the document saved to Salesforce, or even automatically emailed out to someone.
- PS0=1: This enables PDF encryption. I needed this for the next parameter.
- PS1=1: This allows for the PDF to be printed.
This will run the merge, generate the document, and deliver a PDF for printing right to your user....with one click!

