3

I've running some custom code within the Non-Profit Starter Pack (NPSP). A big part of that code is a REST interface that imports data from an outside source. I have triggers attached to the output object from the REST interface that assign it to a Contact record(and creates if it does exist) and then an Opportunity(again, creates if it does not exist). The problem is, I cannot run both of those operation because it causes me to overrun SOQL queries. Both operations are completely bulk-safe, but I cannot seem to find a way to use both.

Looking at my logs, it appears that the NPSP does a significant amount of SOQL, and that seems to be what is eating up all of my queries for my operations. @Async would be nice, but converting these objects to primary types would be dreadful. Anyone have any other tricks for getting into another context, or otherwise saving SOQL queries from the NPSP? I am totally stumped here!

  • 5
    Too Many SOQL Queries can sometimes be a mask for infinite-loop problems. Is there a chance that NPSP is making a change that starts one of your triggers, and then your trigger is making NPSP fire? – Jeremy Nottingham Oct 30 '14 at 2:02
  • 3
    I think that is exactly what is going on. Further investigation with the detailed logging windows shows the trigger running multiple times. When it should only be running once. A standard recursion-stopping class was used and all seems well now. This was the first time I've seen an infinite trigger masked like this, it's usually a lot easier to identify! @JeremyNottingham if you convert this into an answer I'll let you have it help.salesforce.com/apex/… – Lee Harrison Oct 30 '14 at 2:32
2

Too Many SOQL Queries can sometimes be a mask for infinite-loop problems. Is there a chance that NPSP is making a change that starts one of your triggers, and then your trigger is making NPSP fire?

My troubleshooting to find this would be to look for the name of the trigger in the debug log, and then see if there are multiple entries/exits to the same trigger.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.