Future method cannot be called from a future or batch method


我们知道future方法在batch或者future方法中被调用,会报如下的错误:
caused by: System.AsyncException: Future method cannot be called from a future or batch method.

但有时候,因为batch触发了trigger,而trigger调用了future,也会出现同样的错误。

那如何解决呢?

有一种思路就是用Salesforce提供的Platform Event来重写trigger中将要调用的那个future方法