Has anyone successfully associated a docusign envelop sent in REST API to a custom object? This post "Attaching a visualforce page rendered as PDF to Docusign email" showed how to associate envelop to a standard object such as opportunity.

DocuSignAPI.CustomField field = new DocuSignAPI.CustomField (); field.Name = '##SFOpportunity'; field.Value = opportunity.Id;

What would be the field name for a custom object?


So Walter answered it, and mpaler went into behind the scene action. I guess i will just write some code.

//create the envelope
esdsext.DocuSignAPI.EnvelopeInformation envelope = new esdsext.DocuSignAPI.EnvelopeInformation();
envelope.Subject = 'Envelope Subject' ;     
envelope.EmailBlurb = 'Email Blurb';

//use custom field to store the id of the record that initiated the transaction    
envelope.CustomFields = new esdsext.DocuSignAPI.ArrayOfCustomField();
envelope.CustomFields.CustomField = new esdsext.DocuSignAPI.CustomField[2];
esdsext.DocuSignAPI.CustomField myCustomField = new esdsext.DocuSignAPI.CustomField();
myCustomField.Name = 'DSFSSourceObjectId'; //this is what walter and mpaler talked about
myCustomField.Value = <Id of the custom object record>; //for example, pass the id of current record via VF page, and write this line as myCustomField.Value = my_custom_Object.Id;
myCustomField.Show = 'False';
myCustomField.Required = 'False';
myCustomField.CustomFieldType = 'Text';
envelope.CustomFields.CustomField[0] = myCustomField;

//after this, do other stuff, like mention recipients, template, etc and send the envelope

The field name needs to be DSFSSourceObjectId

  • 2
    Hey Walter, welcome to SFSE. Could you expand on this a little to provide a full example? – Matt Lacey Feb 19 '15 at 23:17

Walter actually answers the question, but without much explanation. When you are connecting envelope to a custom object using the SOAP API, for the custom field "Name" you need use the "DocuSign Field" value that maps to the SF custom object. This image should make it more clear:

Docusign SalesForce Connect UI

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.