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
Paul BrainardPaul Brainard 

Help with IF statement OR

I want to be able to say If tempc.Status is not equal to 'Active' OR 'Intake', how would that statement look?  I've tried a bunch of different ways and nothing is working.

 // make sure the case is active or in intake status
        if(tempc.Status__c != 'Active') {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'The case you selected is not in Intake or Active. Please only select Intake/Active Cases or create a new one.'));
            return null;
            }
Saravanan Gengan 9Saravanan Gengan 9
List<Sting> status = new List<Sting> {'Active', 'InTake'} ;
If(!status.contains(empc.Status__c)) { 
//
}

 
Aslam ChaudharyAslam Chaudhary
You can also use below code

if(tempc.Status__c != 'Active' && tempc.Status__c != 'Intake' )