Create Unclaimed Draft

Creates a new Draft that can be claimed using the claim URL

🚧

In order to claim the url you must have a verified active HelloSign Account. This is not an embedded claim url, you cannot use the following example How to Open an Embedded Claim URL.

📘

The first authenticated user to access the URL will claim the Draft and will be shown either the "Sign and send" or the "Request signature" page with the Draft loaded. Subsequent access to the claim URL will result in a 404.

Class: HelloSign.SignatureRequestService

Return type: HelloSign.ServiceObjects.UnclaimedDraftResponse

Method

Name

createUnclaimedDraft()

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

type_x

String

The type of unclaimed draft to create. Use "send_document" to create a claimable file, and "request_signature" for a claimable signature request. If the type is "request_signature" then signers name and email_address are not optional.

signers

Map<String, HelloSign.ServiceObjects.Signer>

The list of recipients who will be required to sign.

test_mode

Boolean

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

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.

attachments

Map<Integer, HelloSign.ServiceObjects.Attachment_x>

List of Attachments for each signer to upload.

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.

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.

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.

allow_decline

Boolean

Allows signers to decline to sign a document.

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.type_x = 'request_signature';
sigReq.file_url = new List<String>{ 'https://www.irs.gov/pub/irs-pdf/fw4.pdf' };

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.subject = 'Testing this signature request';
sigReq.message = 'Hello, please sign the following document. Thank you';

// 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.signer_index = 0;
attachObj.required = true;
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.type_x = true;   
sigReq.signing_options.upload = false;
sigReq.signing_options.phone = false;
sigReq.signing_options.default_x = 'draw';

// Change the date format for the signature date
// See https://app.hellosign.com/api/reference#DateFormats for allowed formats
sigReq.field_options = new Hellosign.ServiceObjects.FieldOptions();
sigReq.field_options.date_format = 'MM / DD / YYYY';

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

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

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