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
Giancarlo AmatiGiancarlo Amati 

unexpected ==

Hi Team,

I have a button on my layout that executes a Javascript, but when clicking on it I receive "Unexpected ===" where SBQQ__Quote__c.SBQQ__BillingFrequency__c is a picklist but I cannot understand why.

Any help?
Thank you
GC
this.disabled = true;
this.className = 'btnDisabled';
​​​​​​​if ( {!SBQQ__Quote__c.SBQQ__BillingFrequency__c} === null) {

window.alert(' The \'Billing Frequency\' field is blank and needs to be populated before submitting this quote for approval. Please update the \'Pay Upfront\' field on the associated opportunity to enter a value into \'Billing Frequency\' ' );

}
else
window.location='./apex/SubmitQuote?Id={!SBQQ__Quote__c.Id}';

 
Best Answer chosen by Giancarlo Amati
Giancarlo AmatiGiancarlo Amati
So I've found the solution:

if ( {!ISPICKVAL(SBQQ__Quote__c.SBQQ__BillingFrequency__c,'')} ) {

window.alert(" The Billing Frequency field is blank and needs to be populated before submitting this quote for approval. Please update the Pay Upfront field on the associated opportunity to enter a value into Billing Frequency ");

}
else window.location='./apex/SubmitQuote?Id={!SBQQ__Quote__c.Id}';

All Answers

VinayVinay (Salesforce Developers) 
Hi,

Update if condition with below snippet.
if ( {!SBQQ__Quote__c.SBQQ__BillingFrequency__c} == null) {

You have given '===' which should be '=='

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
Giancarlo AmatiGiancarlo Amati
I tried that already but that one didn't work either, this is what I get:

User-added image


below my full code:
this.disabled = true;
this.className = 'btnDisabled';



if ( {!SBQQ__Quote__c.SBQQ__BillingFrequency__c} == null) {

window.alert(' The \'Billing Frequency\' field is blank and needs to be populated before submitting this quote for approval. Please update the \'Pay Upfront\' field on the associated opportunity to enter a value into \'Billing Frequency\' ' );

} 
else window.location='./apex/SubmitQuote?Id={!SBQQ__Quote__c.Id}';


 
Giancarlo AmatiGiancarlo Amati
So I've found the solution:

if ( {!ISPICKVAL(SBQQ__Quote__c.SBQQ__BillingFrequency__c,'')} ) {

window.alert(" The Billing Frequency field is blank and needs to be populated before submitting this quote for approval. Please update the Pay Upfront field on the associated opportunity to enter a value into Billing Frequency ");

}
else window.location='./apex/SubmitQuote?Id={!SBQQ__Quote__c.Id}';
This was selected as the best answer