You need to sign in to do that
Don't have an account?
how to use not contain condition in apex?
IF (object.Field__c.contains( 'string' ) ?
LIke..
IF (object.Field__c. NOT contains( 'string' ) ?
do {
}
LIke..
IF (object.Field__c. NOT contains( 'string' ) ?
do {
}
The contains method returns a boolean, so you can use boolean operators on the result.
Some of the various operators include:
&& (And)
|| (Or)
|= (Assigns the result of the OR condition back to the variable in front of it)
&= (Assigns the result of the AND conditon back to the variable in front of it)
Finally the one that you need is:
! (Not some condition)
In other words change your IF statement to the following:
You may need to check for null conditions on object / Field__c as well. You may also want to use containsIgnoreCase instead of "contains" if you want a case-insensitive check.