本文介绍了自定义Salesforce(docusign)按钮未触发。提供错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在salesforce的机会对象上构建了一个自定义按钮,以链接回docusign并执行一组非常特定的操作。首先,当我将按钮放入Salesforce时,我会收到一个错误代码。现在,我根本无法启动按钮。我在该按钮上运行了萤火虫,并且看到存在JavaScript错误。我将在这里发布所有内容。您还可以在此处引用我以前的问题:

I have built a custom button in salesforce on the opportunity object to link back to docusign and run a very specific set of actions. At first when i put the button in salesforce i would receive an error code. Now, i cannot get the button to fire at all. I ran firebug on the button and i see that there is a javascript error. I will pubslish all that i have here. You can also reference my previous question here: Custom Salesforce button for Docusign giving error - unexpected token~

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

//********* Option Declarations (Do not modify )*********//var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';varCCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';varCES='';var STB='';varSSB='';var SES='';var SEM='';var SRS='';var SCS ='';varRES='';//*************************************************//

// Modify individual options here://RSRO = '1';RROS = '1';CRL = '[email protected];FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1'; OCO = 'Tag';LA = '1';STB = '1';SSB = '1';SES = '1';SEM = '1';SRS = '1';

//********* 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;
//*******************************************//

这是我在萤火虫中看到的错误代码:

Here is the error code i see from within firebug:

<script>
window.invokeOnClickJS_00bj0000001KavA = function(element) {
function getRecordIds(keyPrefix) { return Scontrol.prototype.getSelectedRecordIdsFromForm(element.form, keyPrefix); }
element.invokeAction = function() {
var scriptLibrary = [];
scriptLibrary.push("/apex/dsfs__DocuSign_JavaScript");
Util.loadScripts(scriptLibrary, 0, function() {
try { Util.stripCustomFunctionFromObjectPrototype(Array);eval('\r\n\r\n/\/\*\*\*\*\*\*\*\*\* Option Declarations (Do not modify )\*\*\*\*\*\*\*\*\*\//var RC = \'\';var RSL=\'\';var RSRO=\'\';var RROS=\'\';var CCRM=\'\';var CCTM=\'\';varCCNM=\'\';var CRCL=\'\'; var CRL=\'\';var OCO=\'\';var DST=\'\';var LA=\'\';var CEM=\'\';varCES=\'\';var STB=\'\';varSSB=\'\';var SES=\'\';var SEM=\'\';var SRS=\'\';var SCS =\'\';varRES=\'\';/\/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\//\r\n\r\n// Modify individual options here://RSRO = \'1\';RROS = \'1\';CRL = \'[email protected];FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1\'; OCO = \'Tag\';LA = \'1\';STB = \'1\';SSB = \'1\';SES = \'1\';SEM = \'1\';SRS = \'1\';\r\n\r\n/\/\*\*\*\*\*\*\*\*\* Page Callout (Do not modify) \*\*\*\*\*\*\*\*\*\//window.location.href =\"/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID=006j000000KsS79&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;\r\n/\/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\//') } catch (e) { alert('A problem with the OnClick JavaScript for this button or link was encountered:\n\n' + (e.message ? e.message : e)) }
finally { Util.restoreCustomFunctionsToObjectPrototype(Array);}
});
};
element.invokeAction();
}
</script>


推荐答案

我不认为您要结束评论正确地。通常,注释本身就是一行,或者使用注释序列的特定结尾。

I don't think you're ending the comments correctly. Normally, comments are on a line by themselves or use a specific end of comment sequence.

您似乎可以在按钮代码中包含多行。您确定可以吗?我会把它缩小和缩小。

You seem to be able to have multiple lines in your button code. Are you sure that you can? I'd make it all smaller and tighter.

您还会遇到一些错误,例如 varCCNM 而不是正确的 var CCNM (关键字 var

You also have some errors such as varCCNM instead of the correct var CCNM (You need a space after the keyword var

后需要一个空格。请注意,您可以有多个Javascript var一条语句中的声明,例如:

Note that you can have multiple Javascript var declarations in one statement. Eg:

var a=1, b=2;
// Instead of
var a=1; var b=2;

所以我会尝试

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

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

RSRO = '1'; RROS = '1'; CRL = '[email protected];FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1'; OCO='Tag';LA='1';STB ='1';SSB = '1';SES = '1';SEM = '1';SRS = '1';

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;

如果按钮定义不能包含换行符,则只需将以上内容连接在一起即可。

If button definitions can't contain new line characters, then just concatenate the above together onto one line.

这篇关于自定义Salesforce(docusign)按钮未触发。提供错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 12:49