You are here:
sendEnvelope Method
This method enables a new DocuSign transaction. When a contract document is available to send for eSignature, the org can programmatically send it to DocuSign. Vlocity CLM notifies the recipients and can include a message. You can configure who the recipients are, where in the contract they sign, and label and other text used.
Parameters
The envelope object requires the following properties to be set up:
Parameter |
Description |
|---|---|
|
This contains information used in creating the expected envelope structure that DocuSign expects. Supported formats are Map<String, Object>, String in JSON format, andGenericDocuSignObject.Envelope object |
-
parentId
-
document
-
recipients
Request Body
// initialize the parameters
Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();
// create document to be sent
Map<String, Object> document01 = new Map<String, Object>();
document01.put('name', 'TXU.pdf');
document01.put('sourceId', '0686g000009B5ftAAC');
document01.put('fileExtension', 'PDF');
document01.put('sourceType', 'Content');
document01.put('documentId', '1');
// add document(s) to be sent
List<Map<String, Object>> documents = new List<Map<String, Object>>();
documents.add(document01);
//can send multiple documents, if needed
//documents.add(document02);
// create signer
Map<String, Object> signer01 = new Map<String, Object>();
signer01.put('name', 'vlocity_test01');
signer01.put('email', 'vlocity_test01@yopmail.com');
signer01.put('routingOrder', '1');
signer01.put('recipientId', '1');
signer01.put('signerRole', '1');
// add signers
List<Map<String, Object>> signers = new List<Map<String, Object>>();
signers.add(signer01);
//can add multiple signers, if needed
//signers.add(signer02);
// setup signers
Map<String, Object> recipients = new Map<String, Object>();
recipients.put('signers', signers);
// create envelope
Map<String, Object> envelope = new Map<String, Object>();
envelope.put('parentId', '0Q06g000000F0aLCAS');
envelope.put('emailSubject', 'Test Email');
envelope.put('emailBody', 'Email Body');
envelope.put('recipients', recipients);
envelope.put('documents', documents);
// set envelope as input parameter
input.put('envelope', envelope);
// instantiate the generic api
VlocityOpenInterface2 voi = new GenericDocuSignIntegrationService();
// invoke the method
voi.invokeMethod('sendEnvelope', input, output, options);
// log result
System.debug('outputMap: ' + JSON.serialize(output)); Refer to the Supported JSON Envelope Structure for other properties that can be set and their descriptions.

