I have a custom button in Salesforce that I am trying to configure to auto populate the recipients. I have a custom Salesforce object 'Approver' that is related to the object I have the custom button configured for. The approver object is a lookup relationship object to the Contacts object. Approver object has the fields of 'Approver Email', 'First Name', 'Last Name', and 'Role'. Approver Email, First Name, and Last Name fields are formula fields bringing this information from the contact . The Role field is a picklist field that contains the same values as I have configured in my envelope settings for DocuSign for Salesforce.
I have tried to write the code in the button JavaScript to auto populate the contacts selected in the Approver object, but the button is not even inserting recipient roles into the envelope. Below is how I have coded the JavaScript of the sections of CCRM, CCTM, CCNM, and CRCL
Any help would be much appreciated
CCRM ='1~Appr 1 Level 1;2~Appr 2 Level 1;3~Appr 3 Level 1;4~Appr 4 Level 1;5~Appr 5 Level 1;6~Reviewer 1;7~Reviewer 2;8~Reviewer 3;9~Reviewer 4;10~Reviewer 5;11~Appr 1 Level 2;12~Appr 2 Level 2;13~Appr 3 Level 2;14~Appr 4 Level 2;15~Appr 1 Level 3;16~Appr 2 Level 3;17~Appr 3 Level 3;18~Appr 1 Level 4;19~Appr 2 Level 4;20~Appr 1 Level 5;21~Appr 2 Level 5'; // Custom Contact Type Map CCTM ='1~Signer;2~Signer;3~Signer;4~Signer;5~Signer;6~Acknowledge Receipt;7~Acknowledge Receipt;8~Acknowledge Receipt;9~Acknowledge Receipt;10~Acknowledge Receipt;11~Signer;12~Signer;13~Signer;14~Signer;15~Signer;16~Signer;17~Signer;18~Signer;19~Signer;20~Signer;21~Signer'; // Custom Contact Note Map (default no note) CCNM = ''; //Ex: 'Decision Maker~Note for DM;Economic Buyer~Note For EB;DEFAULT_NOTE~Default Note' // Custom Related Contact List (default object contact) CRCL ='Approver__r,Email~Approver_Email__c;FirstName~First_Name__c;LastName~Last_Name__c;ApRole~Role__c;LoadDefaultContacts~0' //Ex:'Approver__r,Email~Email__c;FirstName~First_Name__c;LastName~Last_Name__c;Role~Role__c,LoadDefaultContacts~0'
I suspect you want loadDefaultContacts~1 in CRCL per the documentation "The LoadDefaultContacts parameter determines if default contacts for the source object type are loaded (0 – do not load, 1 – load)."
How I would debug:
a. Add Alerts (controlled by debug var, change to true to see them)
b. Add Try Catch finally
c. Review the below Sample Custom button and compare to what you are trying to accomplish, taking it one step at a time
d. use Chrome to debug and step into the virtual function that is created on your Salesforce page so you can see the variables and related values that are generated from the {!} SF tokens, etc
-SAMPLE GENERIC CUSTOM BUTTON:-
-SAMPLE COMPLEX CUSTOM BUTTON USING SOQL AND BUILD UP OF CRL/CCRM/CCTM -