Create Embedded Unclaimed Draft

Creates a new Draft that can be claimed and used in an embedded iFrame

📘

The first authenticated user to access the URL will claim the Draft and will be shown the "Request signature" page with the Draft loaded. Subsequent access to the claim URL will result in a 404. For this embedded endpoint the requester_email_address parameter is required.

🚧

Embedded unclaimed drafts can only be accessed in embedded iFrames whereas normal drafts can be used and accessed on HelloSign. Please see How to Open an Embedded Claim URL for more info.

Class: HelloSign.SignatureRequestService

Return type: UnclaimedDraftResponse

Method

Name

createEmbeddedUnclaimedDraft()

Acceptable Parameters

Name

Type

Required

Note

originObjectId

Id

Set 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

fileIds

List<Id>

Accepted Id types are ContentDocument, Attachment, or Document.

Cannot use file_url when this is set

file_url

List<String>

Cannot use fileIds when this is set

requester_email_address

String

test_mode

Boolean

The signature request will not be legally binding when set to true.

type_x

String

The type of the draft. By default this is "request_signature", but you can set it to "send_document" if you want to self sign a document and download it.

subject

String

The subject in the email that will be sent to the signers.

message

String

The custom message in the email that will be sent to the signers.

signers

Map<String, HelloSign.ServiceObjects.Signer>

The list of recipients who will be required to sign.

attachments

Map<Integer, HelloSign.ServiceObjects.Attachment_x>

List of Attachments for each signer to upload.

cc_email_addresses

List<String>

List of recipients who will receive a copy only.

signing_redirect_url

String

The URL you want signers redirected to after they successfully sign.

custom_fields

List<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.

use_text_tags

Boolean

Please see Text Tags Syntax on how to use text tags.

use_preexisting_fields

Boolean

If your PDF contains pre-defined fields, enable the detection of these fields.

we only support use of either use_text_tags or use_preexisting_fields parameter, not both.

hide_text_tags

Boolean

When 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.

skip_me_now

Boolean

Disables the "Me (Now)" option for the person preparing the document. Does not work with type "send_document".

allow_decline

Boolean

Allows signers to decline to sign a document.

allow_reassign

Boolean

Allows signers to reassign their signature requests to other signers.

allow_ccs

Boolean

This allows the requester to specify whether the user is allowed to provide email addresses to CC when claiming the draft.

hold_request

Boolean

The request from this draft will not automatically send to signers post-claim.

signing_options

HelloSign.ServiceObjects.SigningOptions

If signing_options are not defined in the request, the allowed types will default to those specified in the account settings.

field_options

HelloSign.ServiceObjects.FieldOptions

This allows the requester to specify field options for a signature request.

isLastCallout

Boolean

HelloSign.SignatureRequestService sigReq = new HelloSign.SignatureRequestService();

/**
 * Required Params
 */
sigReq.requester_email_address = '[email protected]';

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 createEmbeddedUnclaimedDraftWithTemplate 
    // 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.type_x = 'request_signature';
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.use_text_tags = true;
sigReq.skip_me_now = true;
sigReq.allow_decline = true;
sigReq.allow_reassign = true;
sigReq.allow_ccs = 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 };

HelloSign.ServiceObjects.CustomField customField = new HelloSign.ServiceObjects.CustomField(
    'myCustomField',
    'Hello Custom Field'
);
customField.validation_type = 'letters_only';
sigReq.custom_fields = new List<HelloSign.ServiceObjects.CustomField>{ customField };

// 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 = 'type';

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

// Send the request
HelloSign.ServiceObjects.UnclaimedDraftResponse response = sigReq.createEmbeddedUnclaimedDraft();

// Object type: HelloSign.ServiceObjects.UnclaimedDraft
System.debug(response.unclaimed_draft);

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