问题描述
我正在编写一个代码,其中我想使用流程生成器来更新记录中的文本框。这是功能。
- 在文本框中输入文本。
- 爱因斯坦预测服务部将得到感动。
- 更新记录中的相关文本字段。
这是我的代码。
@invocableMethod(label='Get Prediction')
public static void UpdateEngagement(List<getInputDetails> getIDetails){
String s = JSON.serialize(getIDetails);
AI_EngagementSentiment_PB.service(s);
}
@future(callout=true)
public static void service(String s){
einsteinplay.Einstein_PredictionService service = new einsteinplay.Einstein_PredictionService(einsteinplay.Einstein_PredictionService.Types.SENTIMENT);
System.debug(s);
List<getInputDetails> details = (List<getInputDetails>)JSON.deserialize(s,List<getInputDetails>.class);
System.debug('details.textToPredict');
System.debug(details[0].textToPredict);
einsteinplay.Einstein_PredictionResult prediction = service.predictSentiment('CommunitySentiment',details[0].textToPredict,3,null);
System.debug(prediction);
System.debug('in If');
Engagement__c EngagementUpdate;
EngagementUpdate = [select Positive_Sentiment__c,Negative_Sentiment__c,Neutral_Sentiment__c from Engagement__c where id = : details[0].caseID];
EngagementUpdate.Neutral_Sentiment__c = prediction.probabilities[0].probability;
EngagementUpdate.Positive_Sentiment__c = prediction.probabilities[1].probability;
EngagementUpdate.Negative_Sentiment__c = prediction.probabilities[2].probability;
Update EngagementUpdate;
}
运行此命令时,我得到的结果(全部Sys.debug
个)一直到in if
,但是此后抛出以下错误。
02:12:24:218 FATAL_ERROR System.DmlException: Update Failed. First exception on row 0 with id a0W4K000000kc6vUAA; first error: CANNOT_EXECUTE_FLOW_TRIGGER,We can't save this record because the “AI Engagement Sentiment” process Failed. Give your Salesforce admin these details. An Apex error occurred: System.AsyncException: Future method cannot be called from a future or batch method: AI_EngagementSentiment_PB.service(String)
请让我知道我要去哪里哪里以及如何解决这个问题。
以下是字段
谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)