▲ Top

Working with Dynamic Doc-Creation Apps

By leveraging the Auto-Prepare feature of OneSpan Sign, various third-party applications can automatically create and distribute sophisticated third-party documents after populating their rich templates with Salesforce data.

That data can come either from Salesforce's standard or custom objects, or from external Data Sources via Lightning Connect.

Conga Composer

Conga Composer is one of the third-party applications referenced above. It imports Salesforce data by means of a Salesforce Custom Button.

The procedure below describes how to integrate Conga with OneSpan Sign for Salesforce in order to create exactly such a Custom Button in a Salesforce contact object.

When an end-user clicks that button:

  1. A document will be created with Conga.
  2. That document will be attached to the relevant Salesforce record.
  3. a OneSpan Sign package will be created, and the document will be attached to it.
  4. Signature Blocks for two recipients will be created in the document (via a suitable Convention and Recipient Labels).
  5. The package will be sent.

Prerequisites

Action

To create a Custom Button that can interact with Conga in the manner described above:

  1. Go to Setup > App Setup > Create > Objects.
  2. Select the OneSpan Sign Transaction object.
  3. In the Buttons, Links and Actions section of the OneSpan Sign Transaction Object page, click New Button or Link.
  4. Choose a display type for the button you want to create. There are three possible types:
    • Page Link — Creates a link that you can add to the links section of any Detail page. Links can display other pages or websites.
    • Page Button — Creates a button that you can add to the heading of any Detail page. Detail-page buttons act on the record that the user is viewing.
    • List Button — Creates a button that you can add to the heading of any list view or related list. List buttons enable users to select multiple items in a list, and to act on all of them at once.
    • To add list buttons to a related list, edit its properties on the page layout where the related list for an OneSpan Sign package appears.

  5. Select Behavior: Execute JavaScript and Content Source: OnClick JavaScript.
  6. Write and run a variation of the following sample JavaScript code. To make the code work, you must replace its placeholders for Salesforce's Id parameters.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
	var ParentObjectId = '{!Contact.Id}';
	var TransactionName = '{!Contact.Name} CongaPOC';
	var RecipientId = '{!Contact.Id}';
	var Send = true;
	var congaParameters =
	"SessionId={!API.Session_ID}&ServerUrl={!API.Partner_Server_URL_210}
	&Id={!Contact.Id}&TemplateId=00P11000002ImxI&ds7=5&defaultPDF=1&OCNR=1";
	//Change popup visual here
	var popup = 
	window.open("https://composer.congamerge.com?" + congaParameters, 
	'Conga','menubar=no,scrollbars=no,top=100,left=100,width=300,height=200');
	//Do not modify below this line
	var timer = setInterval(function() {
	if(popup.closed) {
	clearInterval(timer);
	var attach = 
	sforce.connection.query("select id from attachment where ParentId ='" 
	+ ParentObjectId+"' order by createddate desc limit 1");
	if(attach.records != null) {
	var packageParameters = 
	'ParentId='+ParentObjectId
	+ '&Name='+TransactionName+'&Documents=' + attach.records.Id
	+ '&Signer1=' + RecipientId + '&Signer2=' + '0031100000eKoFW'
	+ '&ConventionId=a0711000003AGvj'
	+ '&Signer1Label=a0L110000035S7k'
	+ '&retURL={!URLENCODE(Contact.Id)}';
	if(Send) {
	packageParameters += '&Send=1';
	}
	window.location = '/apex/esl__package?' + packageParameters;
	}	
	else {
	window.reload();
	}
	}
}, 500);

The above procedure creates a powerful Custom Button within Salesforce. By clicking it, an end-user triggers the following sequence of events:

To verify the above procedure, certify that the document created by Conga is in the created package. If the inserted Salesforce data does not appear in that document, the responsibility lies with Conga.