You need to sign in to do that
Don't have an account?
Célio Xavier
Creating a case with Apex
Hello,
I need help please, how do I prevent the case from being created in the first condition?
I need help please, how do I prevent the case from being created in the first condition?
public Case generateLog(AccountHistory event) { if(OldValue_c.equals(NewValue_c)){ //Help Case log = new Case(); return log; }else{ Case log = new Case(); log.RecordTypeId = recordTypePrevention; log.AccountId = event.AccountId; log.Origin = 'Phone'; return log; } }
Return Null as David metioned.
But Add one condition check before the adding the case in logs list for loop to avoid this error:
// logs.add(generateLog(event)); comment this line
Case cs = generateLog(event);
if(cs != null)
logs.add(cs);
Thanks,
Maharajan.C
All Answers
Return Null as David metioned.
But Add one condition check before the adding the case in logs list for loop to avoid this error:
// logs.add(generateLog(event)); comment this line
Case cs = generateLog(event);
if(cs != null)
logs.add(cs);
Thanks,
Maharajan.C
A big hug friends.