javascript - Salesforce Button: How To Display An Error if Opportunity Stage Does Not Equal "Closed Won" -
I am creating a DocuSign custom button inside Salesforce. Attempting to add an error when you do not meet certain field values before running the DocuSign button argument.
My desired condition is that if the pickup list value of the occasion stage is not equal to "clean von", then triggers an error message. Other, execute DocuSign custom buttons.
I am very new to javascript and have just started learning, so I apologize for the primary questions and appreciate the feedback.
My current script is below:
{! REQUIRESCRIPT ("/ Apex / Docusign_Javascript")} var oppStage = "off Won"; Var error; {If (chance! Steyname}! = OppStage) {error = "Unable to send envelope. Opportunity stages have not won equal closing."; } Else {// ********* Option Announcement (Do not Modify) ********* var RC = ''; Var rsl = ''; Var rsro = ''; Var rros = ''; Var ccm = ''; Higher cctm = ''; Var ccnm = ''; Var CRCL = ''; Var CRL = ''; Var OCO = ''; Var DST = ''; Var LA = ''; Var ce = ''; Var CES = ''; Var STB = ''; Var SSB = ''; Var ses = ''; Var SEM = ''; Var sss = ''; Var SCS = ''; Var ries = ''; // ************************************************************************************************* * // CES = "Hello World"; CRL = 'first ~ {URLENCODE (User.FirstName)!}; Last name ~ {URLENCODE (User.LastName)!}; Email ~ {URLENCODE (User.Email)!}; Role ~ OppOwner; RoutingOrder ~ 2, LoadDefaultContacts ~ 1 '; CCRM = 'Business User ~ Signer 1'; Opener owner ~ signer 2 '; La = '0'; CEM = 'Hello World, \\ n \\ nThis should be a double line break.'; // ********* Page callout (do not modify) ******** // window.location.href = "/ apex / dsfs__DocuSign_CreateEnvelope? DSEID = 0 and SourceID = {! Opportunity. Id} & amp; RC = "+ RC +" & RSL = "+ RSL +" & RSRO = "+ RSRO +" & RROS = "+ RROS +" & CCRM = " + CCRM + "& CCTM =" + CCTM + "& amp; CRCL =" + CRCL + "& CRL =" + CRL + "& OCO =" + OCO + "& DST =" + DST + "& CCNM =" + CCNM + "& LA =" + LA + "& CEM =" + CEM + "& CES =" + CES + "& SRS =" + SRS + "& STB =" + STB + "& SSB =" + SSB + "& SES =" + SESS + "& SEM =" + SEM + "& SRS =" + SRS + "& SCS =" + SCS + "& RES =" + RES; // * ************************************************************************************************ **************************************************************************** / Pre> The current error message I receive "Ability is not defined" .
Eligibility is the present value of the pickup list on my occasion. If I change this value, then the error message will reflect it.
Thanks in advance. The modified code now triggers the desired behavior that I wanted to:
{! REQUIRESCRIPT ("/ apex / DocuSign_JavaScript")} var oppStage = "off Won"; Var optestage = '{! chance. StageName} '; If (OpptyStage! = OppStage) {Warning ("Unable to send envelope; chance is not equal to winning stage."); } Else {// ********* Option Announcement (Do not Modify) ********* var RC = ''; Var rsl = ''; Var rsro = ''; Var rros = ''; Var ccm = ''; Higher cctm = ''; Var ccnm = ''; Var CRCL = ''; Var CRL = ''; Var OCO = ''; Var DST = ''; Var LA = ''; Var ce = ''; Var CES = ''; Var STB = ''; Var SSB = ''; Var ses = ''; Var SEM = ''; Var sss = ''; Var SCS = ''; Var ries = ''; // ************************************************************************************************* * // CES = "Hello World"; CRL = 'first ~ {URLENCODE (User.FirstName)!}; Last name ~ {URLENCODE (User.LastName)!}; Email ~ {URLENCODE (User.Email)!}; Role ~ OppOwner; RoutingOrder ~ 2, LoadDefaultContacts ~ 1 '; CCRM = 'Business User ~ Signer 1'; Opener owner ~ signer 2 '; La = '0'; CEM = 'Hello World, \\ n \\ nThis should be a double line break.'; // ********* Page callout (do not modify) ******** // window.location.href = "/ apex / dsfs__DocuSign_CreateEnvelope? DSEID = 0 and SourceID = {! Opportunity. Id} & amp; RC = "+ RC +" & RSL = "+ RSL +" & RSRO = "+ RSRO +" & RROS = "+ RROS +" & CCRM = " + CCRM + "& CCTM =" + CCTM + "& amp; CRCL =" + CRCL + "& CRL =" + CRL + "& OCO =" + OCO + "& DST =" + DST + "& CCNM =" + CCNM + "& LA =" + LA + "& CEM =" + CEM + "& CES =" + CES + "& SRS =" + SRS + "& STB =" + STB + "& SSB =" + SSB + "& SES =" + SESS + "& SEM =" + SEM + "& SRS =" + SRS + "& SCS =" + SCS + "& RES =" + RES; // * *************************************** Code> < / Html>
Comments
Post a Comment