I started receiving this error last week and cannot find the reasoning behind it.

Organization: AFCEA User: it@afcea.org

Salesforce reported the below errors as NPSP was attempting to execute its batch jobs, or at a time when it was unable to display error messages directly to a user. It’s likely that NPSP was attempting to update summary fields on Accounts and Contacts, but was unable to save certain records. This failure might have been caused by a variety of issues unrelated to NPSP, such as custom code or validation rules.

Read this article on the Power of Us Hub to learn how these Scheduled Jobs work: https://powerofus.force.com/NPSP_Scheduled_Jobs

Error #1:

Error Type: Batch Apex error Error Date: 2017-07-04 06:00:39 Message: "First error: Update failed. First exception on row 0 with id 0014100000Zs4XHAAZ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AFCEAAccountCallout: execution of AfterUpdate

caused by: System.AsyncException: Future method cannot be called from a f..." Context: npsp__RLLP_OppAccRollup_BATCH

Stack Trace: null


Actually, this sounds like a pretty common error: You cannot call a future method if you are already running in a future context.

This means that at some point you call a method with @future annotation (or a batch) and this method calls another @future method somewhere in it's execution.

Some ways to fix that error is:

If part of this code is on a managed package, you may want to call the creators of the package and see if they can rework that.

  • Hello @Fernando Gavinho. I have two rollup summary field (from Npsp for opportunity) on Account : Number of Membership and Total Membership Amount. This two field can not be manually update. These two fields, will update on records ONLY by NPSP overnight(i guess this is what batch job). is there any way i can tell my trigger on Account(after update), to not fire future method , if the update is coming from these rollups field. – Archita patnaik Jul 6 '17 at 8:53
  • You can check if acc.Total_Membership_Amount__c != Trigger.oldMap.get(acc.Id).acc.Total_Membership_Amount__c) and call the future method or not. – Fernando Gavinho Jul 6 '17 at 9:20
  • Ok understood i can do that. one more option i got now is : !system.isbatch() so i guess , if the update is from batch, then simply dont call future method. – Archita patnaik Jul 6 '17 at 9:59

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.