自定义'使用Docusign发送' Salesforce中的按钮

时间:2015-06-11 21:05:22

标签: javascript salesforce docusignapi

我不是程序员,但需要有关javascript编码的帮助才能完成自定义的' Send with Docusign' salesforce中的按钮。我试图在其中内置3个主要功能

1)它确认在允许用户单击按钮之前填写salesforce中的所有必要合并字段 2)它查看salesforce中某个字段的值,并选择要使用的相应模板(中国与非中国)。每个模板在填充的字段方面完全相同,只是对于正文中的区域具有不同的语言。 3)它使用salesforce合并字段填写正确的模板并发送docusign电子邮件

我在Docusign的初始设置调用中有自定义按钮代码。我可以使用此代码创建两个单独的自定义按钮,但我只需要一个按钮来消除用户错误的机会。他们提供给我的代码在这里:

{!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='';
//*************************************************//
CES='This is my subject'; //Email Subject
CEM='This is my message'; //Email Message
LA='0'; //List Attachments from within Notes and Attachments - 0 or 1
DST='Template ID 1'; //Default Standard Template ID
OCO='Send'; //On Click Options - Send or Tag
CRL='Email~{!Account.Email_of_Signer__c};LastName~{!Account.Name_of_Signer__c};RoutingOrder~1;Role~R1';
CCRM='R1~Signer 1';
//********* Page Callout (Do not modify) *********//
window.location.href="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Account.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;
//*******************************************//

然后我尝试将从其他Salesforce和Docusign论坛上完成上述3点所需的逻辑拼凑起来,但我无法让它发挥作用。再一次,我不是程序员,所以我可能在这里犯了一些非常愚蠢的错误,但我所拥有的是:

{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}
//********* 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='';
//*************************************************//

//Verify that all fields are filled out
if(ISBLANK({!Account.Company_s_Legal_Name__c})||ISBLANK({!Account.Incorporation_Location__c})||ISBLANK({!Account.Principle_Place_of_Business__c})||ISBLANK({!Account.Name_of_Signer__c})||ISBLANK({!Account.Title_of_Signer__c})||ISBLANK({!Account.Email_of_Signer__c})){
alert ("Please feel out all fields in the 'NDA Requirements' section");
}
//Fill out and send Chinese template if incorporated in China or Hong Kong
elseif({!Account.China_or_HK__c}=="China"||{!Account.China_or_HK__c}=="Hong Kong"){
CES='This is my subject'; //Email Subject
CEM='This is my message'; //Email Message
LA='0'; //List Attachments from within Notes and Attachments - 0 or 1
DST='Tempalte ID 1'; //Default Standard Template ID
OCO='Send'; //On Click Options - Send or Tag
CRL='Email~{!Account.Email_of_Signer__c};LastName~{!Account.Name_of_Signer__c};RoutingOrder~1;Role~R1';
CCRM='R1~Signer 1';

//********* Page Callout (Do not modify) *********//
window.location.href="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Account.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;
//*******************************************//
}
//Otherwise fill out and send Non-china template
else{
CES='This is my subject'; //Email Subject
CEM='This is my message'; //Email Message
LA='0'; //List Attachments from within Notes and Attachments - 0 or 1
DST='Template ID 2'; //Default Standard Template ID
OCO='Send'; //On Click Options - Send or Tag
CRL='Email~{!Account.Email_of_Signer__c};LastName~{!Account.Name_of_Signer__c};RoutingOrder~1;Role~R1';
CCRM='R1~Signer 1';

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

我的Docusign Onboarding成功顾问表示,stackoverflow社区可以在这里提供帮助。如果是这样,我将非常感激。即使有编码经验的人可以告诉我这是一件难以实现的事情,也不会有所帮助,所以我可以知道我是否有机会让它独立工作。

1 个答案:

答案 0 :(得分:0)

我认为应该在条件语句中引用合并字段。 而不是:

elseif({!Account.China_or_HK__c}=="China"||{!Account.China_or_HK__c}=="Hong Kong"){

尝试

elseif("{!Account.China_or_HK__c}"=="China"||"{!Account.China_or_HK__c}"=="Hong Kong"){

在所有中执行相同操作如果 其他 elseif