Using Conga within Skuid

  • 5
  • Question
  • Updated 3 years ago
  • Answered
  • (Edited)
Hi Skuid Team,

What is the best way to integrate with Conga Composer? I'd ideally like to either open the conga menu within one of my tabs or for the conga menu to open in a pop-up after a button press.

Thanks
Sam
Photo of sam

sam

  • 588 Points 500 badge 2x thumb

Posted 6 years ago

  • 5
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,262 Points 20k badge 2x thumb
Official Response
Scenario 1: Launch Conga in the same tab / browser window

The simplest way to launch Conga Composer from within a Skuid Page, say an Account Detail page, is to use a PageTitle Action of type "Redirect". The URL that will make this happen is something like this:

https://www.appextremes.com/apps/Conga/Composer.aspx?sessionId={{$Api.Session_Id}}&serverUrl={{$Api.Partner_Server_Url}}&id={{Id}}&reportid=00OW0000000VR5c?pv0={{Name}}&WPD=1


Notice the parts wrapped in double curly braces / "mustaches". These merge variables will pass data specific to your org, or to the record in context, into the URL for Conga Composer to utilize. In this scenario, we are assuming that the PageTitle Action has its "Model" property set to the name of a Model on the Account object --- that way, when this action is clicked, the Account's Id will be fed into the {{Id}} merge variable, and the Account's Name will be fed into the {{Name}} merge variable.

Also, if you wanted to launch Conga Composer from a Table on Accounts, you could instead use a Row Action in the table, with the exact same URL syntax!

Scenario 2: Launch Conga in a separate tab / browser window

To launch Conga Composer in a separate browser tab, you will need to do slightly more work. Follow these 2 steps:

1. Create a new JavaScript Resource of type "Inline (Snippet)". For its name, say "openCongaComposer". For the Resource Body, use the following:



var params = arguments[0];

var url = 'https://www.appextremes.com/apps/Conga/Composer.aspx'
+ '?sessionId={{$Api.Session_Id}}'
+ '&serverUrl={{$Api.Partner_Server_Url}}'
+ '&id={{Id}}';

var merges = skuid.$('<div>').html(params.model.mergeRow(params.row,url));

window.open(merges.text(),'CongaComposer');





2. Add a PageTitle Action (or Row Action) of type "Custom". For "Snippet", enter "openCongaComposer".

Photo of krista06880

krista06880

  • 816 Points 500 badge 2x thumb
Hello Zach,

Thank you for your kind tutorial. Of course, I'm a little stuck. My apologies in advance if I am overlooking something obvious.

I have a custom links on the Campaign record in Salesforce, each linking to different reports we need to run. For instance, a SF Custom Link is called "Candidate Matrix". It features the following URL with merge fields:

https://www.appextremes.com/apps/Cong...
?SessionId={!API.Session_ID}
&ServerUrl={!API.Partner_Server_URL_210}
&ID={!Campaign.Id}
&ReportId=00OA0000004mPPg,00OA0000004mPQF,00OA0000004mjO1,00OA0000004mjOB,00OA0000004mjMp

Step 1.
I converted the URL to one resembling your code:

https://www.appextremes.com/apps/Cong...

Step 2 I added a second layer of brackets around the merge fields. I then switched out "!" for "$", as your example shows. I reduced Campaign.Id to just Id.
I then entered the redirect URL as a Custom Title Action (Redirect) on my CampaignDetail Page. Base on your instructions that this code is designed to open in the same window, I selected Open URL is Current Window.

It tried it with and without the below appended to the end.

={{Name}}&WPD=1

Failed Attempt 1:
https://www.appextremes.com/apps/Cong... ?SessionId={{$API.Session_ID}} &ServerUrl={{$API.Partner_Server_URL_210}} &ID={{Id}} &ReportId=00OA0000004mPPg,00OA0000004mPQF,00OA0000004mjO1,00OA0000004mjOB,00OA0000004mjMp

Failed Attempt 2:
https://www.appextremes.com/apps/Cong... ?SessionId={{$API.Session_ID}} &ServerUrl={{$API.Partner_Server_URL_210}} &ID={{Id}} &ReportId=00OA0000004mPPg,00OA0000004mPQF,00OA0000004mjO1,00OA0000004mjOB,00OA0000004mjMp={{Name}}&WPD=1

Step 3: I also tried the JavaScript, however it is unclear how that will pull the needed reports. I presume that will needed to be added as a + line?

var params = arguments[0];
var url = 'https://www.appextremes.com/apps/Cong...'
+ '?sessionId={{$Api.Session_Id}}'
+ '&serverUrl={{$Api.Partner_Server_Url}}'
+ '&id={{Id}}';
var merges = skuid.$('').html(params.model.mergeRow(params.row,url));
window.open(merges.text(),'CongaComposer');

Possible issues:

1. Conga is pulling data from 3 different reports. I wonder how best to handle that. Do we need to have three separate &ReportID= statements in a row?

2. Your {{Id}} shows as {!Campaign.Id} in the original custom link. Do I need the "Campaign." appended to the Id?

3. I notice ?pv0= is tacked onto the URL before ={{Name}}&WPD=1. Do I need that little bit as well?

If we are going to need to convert SF custom strings to Skuid-worthy strings on a regular basis -- do you have a cheat sheet resource that details what characters need to be replaced to have the URL work in Skuid? Even better, do you have a resource that tells us what the code in the string actually does? For instance, I presume &WPD=1 does something. For you it is likely obvious. For weekend warriors, not so obvious . . .

Thanks!
Photo of Greg Huete

Greg Huete

  • 2,340 Points 2k badge 2x thumb
This is a great thread! Thanks for the work everyone - we also use Conga and this will have a great impact on our implementation of Skuid.
Photo of Greg Huete

Greg Huete

  • 2,340 Points 2k badge 2x thumb
Hey Zach and Krista,

It's true that Zach's solution doesn't fully work, but it definitely set me on the right track. It took me about 3 hours today and a couple phone calls to Conga, but I found a way to make Conga work using SOQL toggle queries instead of reports.

If you like, I could write a short writeup, or if you're interested Zach, I could write a tutorial for you guys on this subject. Conga is a great way to get things to print on paper from Salesforce - this was the biggest problem for our team using Skuid. CSS, jquery, and the rest don't play nicely with printers, even though it looks fantastic on the screen.
Photo of krista06880

krista06880

  • 816 Points 500 badge 2x thumb
I would love a short writeup and/or Tutorial if you'd like to share, to save us from having to do the same calls you did with Conga.
Photo of Greg Huete

Greg Huete

  • 2,340 Points 2k badge 2x thumb
Krista,

I'm trying to get to it, but I'm a little backed up in other work I've got on my plate at the moment. I'll try to do a short write-up by this weekend.
Photo of John Nelson

John Nelson, Product Manager

  • 3,234 Points 3k badge 2x thumb
Greg, please feel free to jump in and post any time you have something you feel is worth sharing! That's really our intention for the community. The easiest way to do it would be to ask the question your write up will answer. Then answer it with your write up.
Photo of Robin

Robin

  • 894 Points 500 badge 2x thumb
Hi Zach and forum,

This is great and definitely got me 99% to working URL code! In our particular button, we have to use a QVar in conga, which in the normal button code looks like this:

&esContactid={QVar0}

I so far have remained unsuccessful with converting this to the correct format (I have tried double brackets, triple brackets, no brackets, quotes).

Not a coder, sorry if this is really obvious!

Thank you for any help in advance,

Robin
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,262 Points 20k badge 2x thumb
Hi Robin,

It might be helpful for you to post the full button code so we can get more of a sense of the role of the QVar here.

From what I know of the use of QVar's in Conga (which is very little), I think that you're supposed to leave the {QVar0} part just as it is, and then Conga interprets it based on other Query String variables. What you need to do then, in addition, is to make sure that the QVar0Id is populated, so that Conga knows what to put in to the {QVar0}. Here's my reference for this:

Advanced Conga Data Gathering parameters

So (shot in the dark here) perhaps this looks something like this:

&QVar0Id={{$Model.Contact.data.0.Id15}}&esContactId={QVar0}
Photo of Robin

Robin

  • 894 Points 500 badge 2x thumb
Hi Zach!

Sorry for the late reply, but you are absolutely correct!

The appropriate format is indeed to leave the {QVar0} brackets as they are. The reason for my code not producing a document was another merge field that did not pull the account ID as I expected.

All working now! Very happy and looking forward to find out what else is possible with Skuid :)

Much appreciated,

Robin
Photo of Rich Slack

Rich Slack

  • 4,154 Points 4k badge 2x thumb
I just went through this process and found the posts somewhat confusing so I wanted to post my success in a way that might help other SKUID/Conga users.

First, Conga suggest users create a button on the standard Salesforce interface. I recommend you do the same. Use the standard interface to build out your Conga button until you get it working exactly as you want it. Follow all CONGA tutorials to get it the way you want it. You will be linking your button to reports or Conga Queries. (if you are using a custom domain you will likely have to use Conga Queries instead of reports). The other thing you will be adding is Parameters to the buttons to tell Conga how you want it to react. Parameters always start with &. For instance "&OFN={!Account.Name}+Welcome+Letter" tells Conga what to save the final document as, in this case "John Doe Welcome Letter.doc". "&WPD=1" creates a protected Word document that can't be edited (you can make certain text boxes editable in this mode, which is cool, if you add "TextBox:" in the merge field in the word document). "&WPD=0" turns off the protected Word document which means the end user can edit the merged document. There are 100's of parameters that can be used to tweak your document.

Here is what my Conga button looked like when I got it functioning as I wanted it to. For me the button was added to the Accounts Object so to view/edit the button I go Setup>Customize>Accounts>Buttons, Links, and Actions.



https://www.appextremes.com/apps/Conga/Composer.aspx
?sessionId={!API.Session_ID}
&serverUrl={!API.Partner_Server_URL_80}
&id={!Account.Id}
&queryid=[Prescription]a0LG000000Gnke6,[ClientHouseArea]a0LG000000GnpVf
&OFN={!Account.Name}+Appointment+Form
&TemplateID=a0EG000000lsrrv
&WPD=1


I now realize that this is JUST a LONG URL that is separated out into separate lines to make it easier to read and keep things straight. That is why the & field proceeds every new parameter, it is just a long URL. If we pasted this URL into our redirect button on our SKUID interface it would not work the way we want it too. We need to tweak the first part of it as Zach taught us above.

This is what my SKUID button looks like after changing it to Zach's recommendations:


https://www.appextremes.com/apps/Conga/Composer.aspx?sessionId={{$Api.Session_Id}}&serverUrl={{$Api.Partner_Server_Url}}&id={{Id}}&queryid=[Prescription]a0LG000000Gnke6,[ClientHouseArea]a0LG000000GnpVf&OFN={{Name}}+Appointment+Form&TemplateID=a0EG000000lsrrv&WPD=1


So let's compare my Conga URL to my SKUID URL. For the SKUID URL
We changed {!Api.Session_ID} to {{$Api.Session_Id}}
We changed {!API.Partner_Server_URL_80} to {{$Api.Partner_Server_Url}}
We changed {!Account.Id} to {{Id}}
Don't change the Conga button URL, just copy and paste the Conga URL somewhere and make the changes to the URL and then copy and paste the corrected version into the Skuid Redirect URL section (likely located as a button on the Page Title Component). Once we make those changes EVERYTHING after the account "{{Id}}" can be copied and pasted from your Standard Conga Button. They are just the parameters that tells Conga what to do.

I will break down the rest of my URL so it makes some sense.
1. &queryid=[Prescription]a0LG000000Gnke6,[ClientHouseArea]a0LG000000GnpVf Is just telling Conga what reports or queries to use. Since I implemented a custom domain (mydomain.my.salesforce.com) the report option does not work so I have to use Conga Query instead. &queryid= is just saying what reports Conga will use to make the merge. The text within the square brackets [Prescription] is just naming the tables so I remember what they are. If you are not using Conga Query and you are using the reports option you would use &reportid= instead of &queryid=.

2. &OFN= just tells Conga what to name my report. In my case I named the document "John DOE Appointment Form".

3. TemplateID= simply tells Conga what template I uploaded into the system to use for this merge.

4. &WPD=1 locks the Word document so people can't edit it.

So again, once you switch the first part of your URL with the {{}} then you just keep adding on your parameters. If you need to add more parameters later just add them on the end with a &whateverparameteryouhappentoneed=.

Once I realized it what just a long URL with all the parameters listed things began to click and it works Perfect!! Just remember, I think it is easiest if you build out your Conga button on the Standard view first and then take the URL, tweak the beginning and paste it in your Redirect URL.

I hope that helps someone! Conga does not realize how to do the workaround so asking them does not help at this point. I told them that I would let them know so they can add it to their solutions database. For the record I would still be bashing my head against the wall if Zach had not taught us about the {{ }}. Thank you ZACH! There is no way I would have figured out the first part. I appreciate your help.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,026 Points 20k badge 2x thumb
Rich - thanks for writing this up.  Its super helpful.  Glad you were able to get this working.  Custom buttons are some of the trickiest things to get right your advice is really good. 
Photo of Rich Slack

Rich Slack

  • 4,154 Points 4k badge 2x thumb
Just tried out the NEW Conga Composer button in the Sandbox! YES! YES! YES! Nice job! That is going to be soo much easier. You really do have an amazing product and an awesome company! Thank you!

"◦Use existing Salesforce Custom Buttons and Links as the action type for Page title buttons. (e.g. if you have an existing Conga Composer Custom Button, you can now add that button to your page with one click.)"
Photo of Tami Lust

Tami Lust

  • 5,282 Points 5k badge 2x thumb
This post has been super helpful! I had to create a Conga Conductor list view button in sandbox. The session id and server url were where I ran into the most problems. Hope this can help someone.


Mass Action on the table and chose custom to put the javascript snippet name in. It is an in-line snippet.

Conga Button Code
var idArray = {!GETRECORDIDS(  $ObjectType.SCMC__Invoicing__c  )};
var urlFieldName="AC_Print_Sales_Invoice_Batch__c";
var CongaURL = "https://conductor.congamerge.com" +
"?sessionId={!$Api.Session_ID}"+
"&serverUrl={!API.Partner_Server_URL_290}"+
"&MOID=" + idArray +
"&UrlFieldName="+urlFieldName;
window.open( CongaURL, "Conga", "width=700,height=450,menubar=0" );

Skuid Button Code
var idArray = skuid.$.map(arguments[0].list.getSelectedItems(),function(item){ 
return item.row.Id; 
}); 
var urlFieldName="AC_Print_Sales_Invoice_Batch__c"; 
var partnerServer = sforce.connection.partnerServerUrls[8];
var CongaURL = "https://conductor.congamerge.com" + 
"?sessionId="+sforce.connection.sessionId+
"&serverUrl="+ partnerServer + 
"&MOID=" + idArray + 
"&UrlFieldName="+urlFieldName; 

window.open( CongaURL, "Conga", "width=700,height=450,menubar=0" );
(Edited)