function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AgilidiRPAgilidiRP 

Javascript custom button questions

Hello-  

 

I posted this question in the customer community, but that may not be the right forum.


I am trying to code a javascript custom button on the opportunity in order to prevent the ability to "Send to EchoSign" unless some conditions are met.  My code is this:

{!REQUIRESCRIPT("/soap/ajax/9.0/connection.js")} 
if('{!User.Quote_Certified__c}'==true || '{!Opportunity.Amount}' < 100000 || '{!Opportunity.Approval_Status__c}' == 'Approved')
{
window.open("/apex/echosign_dev1__AgreementTemplateProcess?masterId={!Opportunity.Id}");
}
else
alert("Opportunity must be approved")
}

First, is the use of javascript in a custom button the best way to restrict access to "Send to EchoSign"?
Second, my condition '{!Opportunity.Amount}' < 100000 is not working.  Is my syntax wrong?

Thanks,
Rich
Best Answer chosen by Admin (Salesforce Developers) 
AgilidiRPAgilidiRP

Werewolf figured it out.  I was trying to compare a string to a number.  Thanks!

All Answers

Ranu JainRanu Jain

Hi,

 

I dont think that there is any problem with syntax. I tried the same and its work perfactly for me .

 

AgilidiRPAgilidiRP

Werewolf figured it out.  I was trying to compare a string to a number.  Thanks!

This was selected as the best answer