if(!ad.Street__c.contains('XXYYZZ'))
{
ForNewRecord.add(ad);
}
I have this piece of code in my class. Where XXYYZZ is a value which can be changed any time. I dont want to hard code in the Class. How can i use Custom Label here.
You should add a null check, and use the System.Label namespace:
ad.Street__c != null && ad.Street__c.contains(Label.XXYYZZ)
System from System.Label.