+ Start a Discussion
erin ryan 8erin ryan 8 

Docusign Button: I'd like to modify our Docusign button

I need to modify our Docusign button , but I'm not sure if it's attainable. Basically , I need the button to be inactive ( annot click) unless 2 checkbox fields on the record are True. Is it possible to add the fields above the Page Call Out?  Thanks ,I'm new to Apex.

{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//* iframe check *//
function inIframe() {
try {
return window.self !== window.top;
}
catch(e) {
return true;
}
}
//* iframe check *//
//********* 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='';
//*************************************************//
DST='{!Order.DocuSign_DST__c}';
CRL='{!Order.DocuSign_CRL__c}';
CCRM='Customer~Signer 1';
//********* Page Callout (Do not modify) *********//
if(inIframe()) {
window.open("{!$Site.BaseUrl}/apex/dsfs__DocuSign_CreateEnvelope?nw=1&DSEID=0&SourceID={!Order.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,"Popup","location=1,status=1,scrollbars=1,resizable=1,directories=1,toolbar=1,titlebar=1,width=1200");
} else {
window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Order.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;
}
//*******************************************//
rajat Maheshwari 6rajat Maheshwari 6

Hi erin,

You need to check the checkbox field before to callout, below is amended code...Hope it will works for you :)



{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//* iframe check *//
function inIframe() {
try {
return window.self !== window.top;
}
catch(e) {
return true;
}
}
//* iframe check *//
//********* 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='';
//*************************************************//
DST='{!Order.DocuSign_DST__c}';
CRL='{!Order.DocuSign_CRL__c}';
CCRM='Customer~Signer 1';

var ContactRecd = sforce.connection.query("SELECT Id,CheckboxField1,CheckboxField2 from Contact where id ='{!Contact.Id}' limit 1"); 

records = ContactRecd.getArray("records"); 

var Checkbox1= records[0].CheckboxField1; 

var Checkbox2 = records[0].CheckboxField2;

if(Checkbox1==true && Checkbox2==true){ 
       if(inIframe()) {
window.open("{!$Site.BaseUrl}/apex/dsfs__DocuSign_CreateEnvelope?nw=1&DSEID=0&SourceID={!Order.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,"Popup","location=1,status=1,scrollbars=1,resizable=1,directories=1,toolbar=1,titlebar=1,width=1200");
} else {
window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Order.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;
}
}
else { 
  alert('Your process can not complete.Please contact with admin");
}



Note : - 

var ContactRecd = sforce.connection.query("SELECT Id,CheckboxField1,CheckboxField2 from Contact where id ='{!Contact.Id}' limit 1"); 
 

1. Replace CheckboxField1 and CheckboxField2 from API name of field.

2. I am assuming contact record on which your button is placed...please replace by the object on which button are placed.

 

Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com