You need to sign in to do that
Don't have an account?
Jonathan Osgood 3
What's wrong with my null check? Getting Null pointer exception after update
Hi All,
Getting Null pointer exception on If Statement Only if field is not populated, after update. Added null check to avoid but it didnt work. What is wroing with my Null check?
Getting Null pointer exception on If Statement Only if field is not populated, after update. Added null check to avoid but it didnt work. What is wroing with my Null check?
if(l.Website_Inquiry_Type__c.containsIgnoreCase('Buy Generator') ||l.Website_Inquiry_Type__c.containsIgnoreCase('Sell Generator') && l.Website_Inquiry_Type__c != null ) { rest of my code that works fine}
First check Website_Inquiry_Type__c is null or not.
or Like this
Let me know if it works.
Mark it as best answer if it works.
Thanks.
All Answers
Operator && is processed prior to ||. Try to put OR part in parentheses. See also,
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_operators_precedence.htm
First check Website_Inquiry_Type__c is null or not.
or Like this
Let me know if it works.
Mark it as best answer if it works.
Thanks.