Guides

Send Signature Request

Creates and sends a new SignatureRequest with the submitted documents

Class: HelloSign.SignatureRequestService

Return type: HelloSign.ServiceObjects.SignatureRequestResponse

Methods

NameNote
send()HelloSign__HelloSign_Signature_Request__c record is created immediately.
send(Boolean createSigReqRecordImmediately)HelloSign__HelloSign_Signature_Request__c record is created later after the apex transaction if createSigReqRecordImmediately is set to false.

Acceptable Parameters

NameTypeRequiredNote
originObjectIdIdSet this if you want your HelloSignSignature_Request_c record to populate the RelatedObject_Id_c field. We will also attempt to populate the lookup field, Account__c for example if the Id is a Supported Object
test_modeBooleanThe signature request will not be legally binding when set to true.
fileIdsListAccepted Id types are ContentDocument, Attachment, or Document.

Cannot use file_url when this is set.
file_urlListCannot use fileIds when this is set.
titleStringThe title you want to assign to the SignatureRequest.
subjectStringThe subject in the email that will be sent to the signers.
messageStringThe custom message in the email that will be sent to the signers.
signing_redirect_urlStringThe URL you want the signer redirected to after they successfully sign.
signersMap<String, HelloSign.ServiceObjects.Signer>The list of recipients who will be required to sign.
attachmentsMap<Integer, HelloSign.ServiceObjects.Attachment_x>List of Attachments for each signer to upload.
custom_fieldsList<HelloSign.ServiceObjects.CustomField>Editable custom_fields are only supported for single signer requests or the first signer of ordered signature requests. If more than one signer is assigned to the unordered signature request, any editor value is ignored and the field will not be editable.
cc_email_addressesListList of recipients who will receive a copy only.
use_text_tagsBooleanPlease see Text Tags Syntax on how to use text tags.
hide_text_tagsBooleanWhen using Text Tags it is preferred that you set this to false and hide your tags with white text or something similar because the automatic removal system can cause unwanted clipping.
allow_declineBooleanAllows signers to decline to sign a document.
allow_reassignBooleanAllows signers to reassign their signature requests to other signers.
signing_optionsHelloSign.ServiceObjects.SigningOptionsIf signing_options are not defined in the request, the allowed types will default to those specified in the account settings.
field_optionsHelloSign.ServiceObjects.FieldOptionsThis allows the requester to specify field options for a signature request.
isLastCalloutBoolean
HelloSign.SignatureRequestService sigReq = new HelloSign.SignatureRequestService();

/**
 * Required Params
 */
ContentVersion cvRec = [SELECT ContentDocumentId FROM ContentVersion WHERE Title = 'myFile.pdf' LIMIT 1];
sigReq.fileIds = new List<Id>{ cvRec.ContentDocumentId };

sigReq.signers = new Map<String, HelloSign.ServiceObjects.Signer>{
    // Adding signers for our request are index based, which is why we are putting 0 as our key
    // Note: this is a string because sendWithTemplate for example is RoleName not index based
    '0' => new HelloSign.ServiceObjects.Signer('[email protected]', 'signer1'),
    '1' => new HelloSign.ServiceObjects.Signer('[email protected]', 'signer2')
};

/**
 * Optional Params
 */
sigReq.test_mode = true;
sigReq.originObjectId = '001f200001cFD4x';
sigReq.title = 'My first signature request';
sigReq.subject = 'Testing this signature request';
sigReq.message = 'Hello, please sign the following document. Thank you';
sigReq.signing_redirect_url = 'https://hellosign.com';
sigReq.cc_email_addresses = new List<String>{ '[email protected]' };
sigReq.allow_decline = true;
sigReq.allow_reassign = true;

// Require a specific signer to upload an attachment
HelloSign.ServiceObjects.Attachment_x attachObj = new HelloSign.ServiceObjects.Attachment_x();
attachObj.name = 'Supplemental Attachment';
attachObj.instructions = 'Please attach any supplemental information, thank you.';
attachObj.required = true;
attachObj.signer_index = 0;
sigReq.attachments = new Map<Integer, HelloSign.ServiceObjects.Attachment_x>{ 0 => attachObj };

// Specify which signing options are allowed for the signer
sigReq.signing_options = new HelloSign.ServiceObjects.SigningOptions();
sigReq.signing_options.draw = true;
sigReq.signing_options.phone = false;
sigReq.signing_options.type_x = true;
sigReq.signing_options.upload = false;
sigReq.signing_options.default_x = 'draw';

sigReq.field_options = new HelloSign.ServiceObjects.FieldOptions();
sigReq.field_options.date_format = 'YYYY / MM / DD';

// Can use this to send
HelloSign.ServiceObjects.SignatureRequestResponse response = sigReq.send();

// Or this
// Do not create HelloSign_Signature_Request__c record immediately.
// This record is created later in case you want to call send() for a list of records
HelloSign.ServiceObjects.SignatureRequestResponse response = sigReq.send(false);

// object type: HelloSign.ServiceObjects.SignatureRequest
System.debug(response.signature_request);

// object type: HelloSign_Signature_Request__c
System.debug(response.signatureRequestRecord);

// object type: List<HelloSign.ServiceObjects.Warning>
System.debug(response.warnings);