Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Conga Query Code Example

Normally when you run the Conga > Batch Invoice action on multiple records (see Conga Batch Solutions - Multiple Rows), Conga Batch creates separate output documents. The custom action code below will add a Conga Query item to the Action menu. It will pass the records into a single Conga Composer solution so that you can merge the records into one document.

Warning:

The following code example only works with unique action names.

var templateId = 'a2to0000000YX8d';var queryId = 'a2lo0000000u0pl';var label = 'Conga Query';crmc.addCustomAction({ "itemID": "CongaQuery", fieldName: '', "isAvailable": function (context) { // This function is called before the action item is displayed and returns a boolean if the item should be displayed // By default determine availability based on Feature Security for this action return this.featureSecurity.getSetting(context.objectDescribe.name, this.itemID) !== false; }, "getLabel": function (context) { // This function returns the display label of the action item and is called before the item is shown return label; }, "createSubmenuItems": function (context) { // If this function returns additional action item objects, they will appear as submenu items return []; }, "click": function (context) { if (context.selectedRows.length > 0) { var ids = ''; Object.each(context.selectedRows, function(item) { if (ids.length > 0) ids += "'|'"; ids += item.Id; }); var url = "https://composer.congamerge.com" + "?sessionId=" + sforce.connection.sessionId + "&ServerUrl=" + context.actionGrid.settings.Partner_Server_URL_290 + "&Id=" + sforce.connection.getUserInfo().userId + "&templateId=" + templateId + "&QueryId="+ queryId +"?pv0='" + ids +"'"; window.open(url, 'Conga', 'width=700,height=450,menubar=0'); } else { kendoPopup.popup('Please select records', 'Select at least one record to send to Conga.'); return; } },});