You need to sign in to do that
Don't have an account?
Mike Reynolds 6
How can I add a condition to this trigger?
Hello,
I need to make my trigger fire only when the case description is not null. is this the right way to approach this? I've really new to APEX and it's really throwing me for a loop.
trigger descUpdate on Case (before update) {
case[] cases = Trigger.new;
if(case.description !=null)
caseDescUpdate.descUpdate(cases);
}
Thanks!
-Mike
I need to make my trigger fire only when the case description is not null. is this the right way to approach this? I've really new to APEX and it's really throwing me for a loop.
trigger descUpdate on Case (before update) {
case[] cases = Trigger.new;
if(case.description !=null)
caseDescUpdate.descUpdate(cases);
}
Thanks!
-Mike
I'm assuming the class performs an update operation somewhere after "//more lines like the one above"?
All Answers
You might want to check for blanks as well. You can do this by using below code.
if(case.description != null && case.description.trim() != ''){
//You code
}
When you say "perform your actions here" i'm looking to call the public class caseDescUpdate. Can I still do that if I use your approach?
Not sure what you're trying to achieve, but to bulkify you may need to build a list within that IF loop, then pass the list to caseDescUpdate (which will need to be modified to accept a list).
I'm assuming the class performs an update operation somewhere after "//more lines like the one above"?