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
WellSky Integration UserWellSky Integration User 

How to check for null

Which is the correct syntax if I want to check for a specific record id and if the type field is not null?
if (a.RecordTypeId == '0125Y000001GTK4QAO' && a.Account_Type__c != 'null')
 
if (a.RecordTypeId == '0125Y000001GTK4QAO' && a.Account_Type__c != null)

 
SwethaSwetha (Salesforce Developers) 
HI,
Account_Type__c!='null' considers null as string and will fire if the field has nulll entered.
You should be using 
if (a.RecordTypeId == '0125Y000001GTK4QAO' && a.Account_Type__c != null)

Alternately, you can try in the validation rule
AND( RecordType.Name="NAME_OF_YOUR_RECORD_TYPE", ISBLANK(TEXT( Account_Type__c)) )

Related: https://support.veeva.com/hc/en-us/articles/115000220593-CRM-Validation-Rule-Works-Offline-but-Not-Online#
If this information helps, please mark the answer as best. Thank you

WellSky Integration UserWellSky Integration User
Thank you!  I like the alternate way you posted better.
WellSky Integration UserWellSky Integration User
I will be using your first example.  The second throws an error: Method does not exist or incorrect signature: void TEXT(String) from the type AccountUpdate
SwethaSwetha (Salesforce Developers) 
I can help. Can you let me know if you are you trying this in a validation rule?