-2

I am using this code on a button in Salesforce -- onClick JavaScript :

Is this is the correct way:

if('{!Account.CSS_CustomerID__c}' != 'null'){

          //do something
}

Should I do like this --1

 if('{!Account.CSS_CustomerID__c}' != null){

              //do something
    }

Should I do like this --2

 if('{!Account.CSS_CustomerID__c}' !== null){

              //do something
    }

Or there is any other way?

ANSWER : This worked for me

 if('{!Account.CSS_CustomerID__c}' !== null){

              //do something
    }
Salesforce Steps
  • 173
  • 1
  • 2
  • 13

1 Answers1

1

With your code you compare two string.

Maybe you need to compare the variable :

if(!Account.CSS_CustomerID__c != null)
R3tep
  • 12,512
  • 10
  • 48
  • 75