ケース(「インシデント」)に登録されたプラグインを取得して、CloseIncidentRequestを正常に呼び出すための同期後イベントを作成しようとしています。CloseIncidentRequestがcaseupdatepostイベントで正常に機能していますが、作成時に「コミットする前にトランザクションを開始する必要があります」という例外が発生し続けます。
これが既知の問題であるかどうかを誰かが知っていますか、または誰かがケース作成ポストイベントでこれを実行していますか?同期から非同期への変更に関する投稿を見たことがあります-プラグインを変更して非同期を実行すると、それは機能します-しかし、理想的には、これを同期的に実行して、ユーザーが保存を押したときにケースが解決されたことを確認できるようにします。
private const int IncidentResolutionStatus_Closed = 2;
private const int IncidentStatusCode_ProblemSolved = 5;
Entity resolution = new Entity("incidentresolution");
resolution["subject"] = "Case Resolved";
resolution["incidentid"] = new EntityReference("incident", IncidentId);
resolution["timespent"] = timespent;
resolution["statuscode"] = new OptionSetValue(IncidentResolutionStatus_Closed);
CloseIncidentRequest closeincidentRequest = new CloseIncidentRequest()
{
IncidentResolution = resolution,
Status = new OptionSetValue((int)IncidentStatusCode_ProblemSolved)
};
service.Execute(closeincidentRequest);