Skip to main content
HI,

 

I have written a custom button to run the approval process, purely because we require two approvals at different stages of the opportunity.

 

I want to write first a check to see if either or both of 2 fields are blank and if so send an error message but I get an illegal statement error

 

Heres what I have: -

 

if(("{!Opportunity.Final_Pricing_Sharepoint_Link__c}" == null &&

 

"{!Opportunity.Final_Price__c}" == null) ||

 

("{!Opportunity.Final_Pricing_Sharepoint_Link__c}" == null) ||

 

("{!Opportunity.Final_Price__c}" == null)){

 

    alert('You cannot submit this Opportunity for Approval without a pricing spreadsheet URL and the Final Price.');

 

return false;

 

Thanks for any help
9 answers
  1. Oct 29, 2015, 8:46 AM

    Missed one && in previous code,try this and let me know:

    {!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}

    {!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")}

    if(({!Opportunity.Final_Pricing_Sharepoint_Link__c} == null &&

    {!Opportunity.Final_Price__c} == null) ||

    ({!Opportunity.Final_Pricing_Sharepoint_Link__c} == null) ||

    ({!Opportunity.Final_Price__c} == null))

    {

    alert('You cannot submit this Opportunity for Approval without a pricing spreadsheet URL and the Final Price.');

    }

     

     
0/9000