We have a custom object called “Legal Contracts” and we have DocuSign linked to it. I need to customize a custom button so that it auto populates the DocuSign Envelope’s Recipient section using the contact information from a lookup field in the custom object.
a. Lookup field: Customer_Signed_By_LC__c
b. Email API from Lookup field: Customer_Signed_By_LC__r.Email
c. Contact ID from Lookupfield: Customer_Signed_By_LC__r.Id
d. Current “working” custom button:
{!IF( Legal_Contract__c.Parent_Company_LC__c = "Company A", URLFOR("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000ANysEAG"]) , URLFOR("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000ANysEAG"]) )}
The following Link gives a good overview (see section: Custom Recipient List (Individuals)) on how to achieve this:
https://support.docusign.com/guides/dfs-admin-guide-customize-envelope-contacts
I updated my code following directions from the link, but I’m getting a Syntax error.
Error: Syntax error. Missing ‘
New code:
{!IF( Legal_Contract__c.Parent_Company_LC__c = "Company A", URLFOR("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000ANysEAG", CRL = 'Email~'+encodeURIComponent('{!Legal_Contract__c.Client_s_Email__c};Role~Signer 2 ]) , URLFOR("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000ANysEAG", CRL = 'Email~'+encodeURIComponent('{!Legal_Contract__c.Client_s_Email__c};Role~Signer 2 ]) )}
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You seem to be missing single quote and closing parenthesis on encodeURIComponent
where you have CRL=....
The encodeURIComponent
should be closed, and should look like as below. Observe the closing ')
.
CRL = 'EMail~' + encodeURIComponent('{!Legal_Contract__c.Client_s_Email__c};Role~Signer 2')
While the answer is specific to the syntax error you are receiving, but I don’t think you can use this JS function in a formula/custom button. The documentation link that you have provided in the question does not clearly specify where does this need to be configured. You may like to check with DocuSign support as well for further details.
If you want to encode the URL, you will need to use URLENCODE(..)
here. Something as:
URLENCODE('{!Legal_Contract__c.Client_s_Email__c};Role~Signer 2')
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0