Apex 处理程序 FATAL_ERROR|System.AsyncException:无法从未来或批处理方法调用未来方法:classA.MethodA(Set<Id>)

问题描述 投票:0回答:1

此时显示错误

请尽快提供帮助。有什么建议

提前致谢

当我评论该部分时,一切正常。当我取消注释时,我收到错误。我不知道为什么会这样

请帮忙

triggers salesforce apex
1个回答
0
投票

该消息是不言自明的:不要使用另一个异步方法中的 @future 方法。 另一种方法是对 @future 方法进行排队。

改变:

@future void FutureMethod( String anyParam ) { 
   [@future code]
}

致:

class FutureClass implements Queueable  {
   String localParam;
   public FutureClass( String strParam ) {
      localParam = strParam;
   }

   public void execute( QueueableContext qc )  { 
         [adapted @future code]
   }
}

电话是:

System.enqueueJob(new FutureClass( strParam );
© www.soinside.com 2019 - 2024. All rights reserved.