0

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

Organization: AFCEA User: [email protected]

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

1 Answer 1

0

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.

3
  • 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. Commented Jul 6, 2017 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. Commented Jul 6, 2017 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. Commented Jul 6, 2017 at 9:59

You must log in to answer this question.

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