-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
    }
3
  • 1
    You are comparing string with string which is un-identical.. Commented Nov 19, 2015 at 14:21
  • it is obvious that first string is not equal to second one, or you did not explain well.. Commented Nov 19, 2015 at 14:21
  • I gone through the existing Question .... But I am not able to find out how to check for NOT EQUAL TO NULL CONDITION there Commented Nov 19, 2015 at 14:30

1 Answer 1

1

With your code you compare two string.

Maybe you need to compare the variable :

if(!Account.CSS_CustomerID__c != null)
Sign up to request clarification or add additional context in comments.

2 Comments

Can you give me the exact syntax for above if condition

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.