1

In our organisation we are using zuora for creating quotes & subscriptions.

In opportunity page we had a custom button to create quotes but it's normally routing to custom VF page.

But whenever a user tries to create any quote, the shipping address should not be null. If shipping address = null, then it needs to throw error to user.

So, I created this custom button:

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")} 

if(ISBLANK({!Opportunity.Shipping_City__c})){ 
alert("Shipping address should not be null") 
} 
else { 
window.open('https://zqu.cs5.visual.force.com/apex/CreateQuote?oppId={!Opportunity.Id}&quoteType=Subscription&scontrolCaching=1&stepNumber=1');

} 

Error is coming like

A problem with the OnClick JavaScript for this button or link was encountered:

ISBLANK is not defined

Why am I getting this error?

0

2 Answers 2

3

You can only use ISBLANK and other merge functions inside a merge field ({!...}).

Incorrect

if(ISBLANK({!Opportunity.Shipping_City__c})){ 

Correct

if({!ISBLANK(Opportunity.Shipping_City__c)}){ 
1

JavaScript doesn't understand ISBLANK. Try something like this:

if('{!Opportunity.Shipping_City__c}') {
  alert("Shipping address should not be null") 
} 
else { 
  window.open('https://zqu.cs5.visual.force.com/apex/CreateQuote?oppId={!Opportunity.Id}&quoteType=Subscription&scontrolCaching=1&stepNumber=1');

} 
1
  • 1
    Wouldn't you want quotes around that merge expression?
    – martin
    Mar 23, 2017 at 14:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .