I am trying to setup Docu Sign for my company and I did all the steps and I got stuck on this. When I press the custom button provided by DocuSign Send with DocuSign that is added to all page layouts. I keep getting this error.

The SourceID value for this DocuSign Custom Button is invalid. Please ask your Salesforce administrator to correct the custom button configuration. See the DocuSign for Salesforce Administrator Guide for more information.

I really don't know what to do. I am totally stuck.

Here is the code behind the custom button, generated by DocuSign.


The error MSG: enter image description here Please advise,


  • can you share the code or URL behind the custom button.
    – Suresh
    Commented May 14, 2015 at 13:47
  • Sure I've edited the question. Please check it out. Commented May 15, 2015 at 7:42
  • Our issue were permissions. Hope it helps Commented Jul 24, 2017 at 21:44

2 Answers 2



Regardless, I couldn't find an answer to this particular issue, but I found one. I tried the different documentations and couldn't get passed the error you were getting.I felt it would be better to answer this one instead of creating a new thread.

I came across the following link: https://www.docusign.com/supportdocs/dfs-admin-guide/Content/admin-guide/sample-js-code-custom-buttons.htm

It has a larger button example, and for whatever reason, this one was able to work properly once adjusted to work with my specific custom sObject, Project__c.

I've included my own code examples, which does have the code block from the above URL in it as well.

Attempt 1 - did not work after a lot of tweaking


Attempt 2 - did not work after a lot of tweaking

var SourceID2 = window.sfdcPage.getEntityId();
window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID="+SourceID2;

Debugging block to attempt to see if there was anything extra I needed from the source ID. There wasn't.

var SourceID1 = window.sfdcPage.entityId;
var SourceID2 = window.sfdcPage.getEntityId();
var SourceID3 = '{!Project__c.Id}';
var SourceID4 = DSGetPageIDFromHref(); 

console.log('This is the value of window.sfdcPage.entityId: '+SourceID1);
console.log('This is the value of window.sfdcPage.getEntityId(): '+SourceID2);
console.log('This is the value of !Project__c.Id: '+SourceID3);
console.log('This is the value of DSGetPageIDFromHref(): '+SourceID4); 

This last block worked after changing the sObject at the very end to be the one I wanted. Besides that I didn't have to edit it at all. If you're looking to copy/paste a solution from this thread, it's this entire below piece you want.

//********* Option Declarations (Do not modify )*********//

var RC = '';var RSL='';var RSRO='';
var RROS='';var CCRM='';varCCTM='';
var CCNM='';var CRCL=''; var CRL='';
var OCO='';var DST='';var LA='';var CEM='';
var CES='';var STB='';var SSB='';var SES='';
var SEM='';var SRS='';var SCS ='';var RES='';


// Modify individual options here: // Related Content (default no related content)

RC = ''; /*Ex: GetRelContentIDs("{!Opportunity.Id}");*/
// Recipient Signer Limit (default no limit)
RSL = ''; //Ex: '3'
// Recipient Starting Routing Order (default 1)
RSRO = ''; // Ex: '1'
// Recipient Routing Order Sequential (default not sequential)
RROS = ''; //Ex: '1'
// Custom Contact Role Map (default config role)
CCRM = ''; /*Ex: 'Decision Maker~Signer1;Economic Buyer~Carbon Copy'*/
// Custom Contact Type Map (default Signer)
CCTM = ''; /*Ex: 'Decision Maker~Signer;Economic Buyer~CC'*/
// 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 = '';     /*Ex:'MyContacts__r,Email~Email__c;FirstName~First_Name__c;LastName~Last_Name__c;Role~Role__c,LoadDefaultContacts~0'*/
// Custom Recipient List
CRL = ''; /*Ex:'Email~;FirstName~;LastName~;Role~SignInPersonName~;RoutingOrder~;AccessCode~;RecipientNote~;SignNow~, LoadDefaultContacts~1'*/
// One Click Option (default edit envelope screen)
OCO = ''; //Ex: Tag
// DocuSign Template ID (default no template)
DST = ''; //Ex: '67870A79-A0B5-4596-8AC1-CC7CC1EA01EB'
// Load Attachments (default on)
LA = ''; //Ex: '0'
// Custom Email Message (default in config)
CEM = ''; //Ex: 'Envelope sent by [FirstName] [LastName] ([Email])!'
// Custom Email Subject (default in config)
CES = ''; //Ex: 'Re: Opportunity Name: {!Opportunity.Name}'
// Show Tag Button (default in config)
STB = ''; //Ex: '1'
// Show Send Button (default in config)
SSB = ''; //Ex: '1'
// Show Email Subject (default in config)
SES = ''; //Ex: '1'
// Show Email Message (default in config)
SEM = ''; //Ex: '1'
// Show Reminder/Expire (default in config)
SRS = ''; //Ex: '1'
// Show Chatter (default in config)
SCS = ''; //Ex: '1'
// Reminder and Expiration Settings
RES = ''; //Ex: '0,1,2,0,120,3'

//********* Page Callout (Do not modify) *********//

//This section is the one you change. Change the sObject reference to the one you want.

//Edit the reference to the sObject in the line below
window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!sObject.Id}&RC="+RC+"&RSL="+

Could you please refer this. It may help you.


In the 9 the step of the above link you find this. If I am not wrong you were missing the merge field in the Id part.

/apex/dsfs__DocuSign_JavaScript?id={!your Object .Id}

I am expecting your url should look like this

  • Hi Suri, Thanks for the reply but unfortunately this doesn't work :(. The code above that is presented in the button perfectly works for opportunities but when you try to add it to Accounts,Leads etc... it blocks giving this MSG that i just edited above. Commented May 19, 2015 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .