Docusign for Salesforce CRCL not populating

2019-03-06 15:27发布

问题:

I have a Docusign Send Now button with the following code:

{!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:

LA = '1';
DST = '';
RC = ''; 
RSL = ''; 
RSRO = ''; 
RROS = '0'; 
CCRM = 'Deal Signer~Signer;Invoice Contact~Carbon Copy'; 
CCTM = 'Signer1~Signer;Carbon Copy~CC'; 
CCNM = '';
CRCL = 'Deal_Contacts__r,Email~Email__c;LastName~Name;Role~Contact_Deal_Role__c;SignNow~Contact_Sign_Now__c;LoadDefaultContacts~0'; 
CRL = ''; 
CEM = ''; //TODO: Set this as a field on the document.
CES = ''; //TODO: Set this as a field on the document.
STB = '0'; 
SSB = '0'; 
SES = '0'; 
SEM = '0'; 
SRS = '0'; 
SCS = '0';
RES = '1,3,3,1,10,1'; 
OCO = 'Tag';

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

window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Deal__c.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;

//*******************************************//

However, when I click the button, the TO fields do not populate. I have setup a custome object on my Deal__c object and everything pulls correctly when I query. Anyone have a similar issue or example code? Thanks!

EDIT: I was able to achieve the desired result with this code:

{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}

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='';

var deal = "{!Deal__c.Id}";
var dealContacts = sforce.apex.execute("GetDealContacts","getDealContacts",{dealID: deal});

if(!dealContacts.length) {
 alert("This Customer Account has no Deal Signers. Please add a Deal Signer to continue.");
 return;
}

var contacts = [];
var number;
for ( var i = 0, l = dealContacts.length; i < l; i++ ) {
var role = "";
number = i + 1
if(dealContacts[i].Role__c === "Deal Signer"){
      role = "Signer" + number.toString();
} else {
      role = "Invoice Contact";
}
contacts.push("Email~" + dealContacts[i].Email__c + ";Role~" + role + ";LastName~" + dealContacts[i].Name + ";SignNow~0");
}

var contactString = contacts.join(",");
contactString += ", LoadDefaultContacts~0";

LA = '1';
RSL = number;
CRL = contactString;
CCTM = 'Invoice Contact~Carbon Copy';
STB = '0';
SSB = '0';
SES = '0';
SEM = '0';
SRS = '0';
SCS = '0';
RES = '1,3,3,1,10,1';
OCO = 'Send';

//********* Page Callout (Do not modify) *********// 
window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Deal__c.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:

Answered above in EDIT. Please see the second code block.