0

What is wrong with this javascript code, I have copy the code from DocuSign website and added to my custom button, I could not able to figured out what is the cause of this error, anybody?

Follow error:

enter image description here

Copy the code from docuSign guide here

{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}


//********* Option Declarations (Do not modify )*********//
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';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~Carbon Copy'
// 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 (Individual)
CRL = ''; //Ex: 'Email~;FirstName~; LastName~; Role~SignInPersonName~; RoutingOrder~; AccessCode~; RecipientNote~; SignNow~, LoadDefaultContacts~1'
// Custom Recipient List (Signing Groups)
CRL = ''; //Ex: 'SigningGroup~; Role~; AccessCode~; RecipientNote~; RoutingOrder~, LoadDefaultContacts~1'
OCO = ''; //Required with signing groups
// One Click Option (default edit envelope screen)
OCO = ''; //Ex: Tag (or Send)
// 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) *********//
window.location.href = 
"/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0
&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"
&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"
&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"
&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"
&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//

1 Answer 1

1

If you have pasted your code exactly as it exists, you have an issue when building your new page URL. "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0 is followed by a newline which results in an unclosed string. You need to either place your whole string on a single line, or close your string and concatenate with the next line.

1
  • Just FYI you can always use a linter like jslint.com to check your JS code for errors. Note that it will not handle VF merge fields so you can either pop single quotes around them for the linter or just remove them when linting.
    – dsharrison
    Commented Oct 3, 2016 at 0:57

You must log in to answer this question.

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