+ Start a Discussion
Ishan Singh 4Ishan Singh 4 

How to use contains in batch class?

Health status is a field whose value can be 'Healthy' or 'healthy'. So i want to use contains in my code so that in either way it should run. I am using it as shown below:

l.Health_Status__c.contains('Healthy')
l is a variable 
Best Answer chosen by Ishan Singh 4
Agustin BAgustin B
HI Ishan, where do you want to filter by "Healthy"?

On the start function of the batch you could filter there Health_Status__c=='Healthy' or Health_Status__c=='healthy'.
If you dont want to filter in the query you can after that in the Start or in the execute filter by "Healthy".
In that case you can use containsIgnoreCase instead of just contains.

If it helps please like and mark as correct, it may help others.