0

I have a question met in the preperation of my apex class test for one trigger.

In the trigger, I have the condition "if (!trigger.isExecuting)" so when I create the apex class test, it doesn't pass after the code in the boucle.

Could you have any ideas how I can jump to the code follows?

Code trigger: enter image description here

Code apex class test: enter image description here

Thanks a lot in your response.

Best, Jiahuan

2
  • I don't see why you would ever want to include code in a trigger that's not executed when running the trigger... Commented Jul 11, 2016 at 13:18
  • In fact, I have another trigger in another object. When I deploy the trigger in production, it displays the error message "Limit the SQL requete 101". So I just want to add a condition to say that if there is already a trigger executed, we don't launch this trigger. It seems IsExcuting is not a good choice. Do you know how to realise that?
    – Jiahuan Xu
    Commented Jul 11, 2016 at 13:46

1 Answer 1

0

isExecuting indicates that the context is a trigger. If you use if(!Trigger.isExecuting) in a trigger. It'll never be called. See the documentation for more info.

2
  • Thanks Fernando, your response is useful. In fact, I have another trigger in another object. When I deploy the trigger in production, it displays the error message "Limit the SQL requete 101". So I just want to add a condition to say that if there is already a trigger executed, we don't launch this trigger. It seems IsExcuting is not a good choice. Do you know how to realise that?
    – Jiahuan Xu
    Commented Jul 11, 2016 at 13:32
  • Take a look here: help.salesforce.com/apex/HTViewSolution?id=000133752 Commented Jul 11, 2016 at 13:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .