[SalesForce] Exact equality operators only allowed for reference types: String

Please find below piece of code where I am getting this error.

Error:

Compile Error: Exact equality operators only allowed for reference
types: String

Code:

if(((inc.Status_abv__c!=='New') || (inc.status_abv__c == 'Under Review')) && change1==false ) //
        { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Your selected Compliance Incident : '+inc.Name+' is not having Status as \'New\'!'));
        pagemsg=true;
        }

Best Answer

You're using !== which besides the values also checks the same location in memory. You can use that only on references but not primitives - check this answer.

You need to use != instead to compare values only.

Related Topic