Can we trigger a workflow once we get an exception from Plugin?
Can we trigger a workflow once we get an exception from Plugin?
I tried to register a plug-in on create of tracelog, but it doesn't work. It is not possible to trigger a Workflow on creation of Plug-in tracelog either;
Add an ExecuteWorkflowRequest() inside the Plug-in catch block is not viable either, as already mentioned on the thread.
But I would suggest to explain better what is your requirements then we could suggest something else.
The answer for this question would be no, it is not possible trigger Workflow when get an exception from Plugin, at least using Dynamics Platform. As mentioned, you can try to call code outside Dynamics platform ( Azure etc) to achieve this.
When you experience an error - everything you did is in transaction and rolled back. The only way I see to do that change is to go outside of transaction - call Azure Function or something like that that will independently update the field.
In case of any plugin exception, I need to clear a field value in CRM form.
Something like this --> entity.Attributes["myfield"] = "";
The above method doesn't work, so I thought of trying by calling a workflow to clear the field value.
Any thoughts?
Hi,
You can call workflow from below code:
var executeWorkflowRequest = new ExecuteWorkflowRequest() { WorkflowId = Guid.Parse("24dc5603-a117-4221-a7bb-5b6ed17a1810"), // Guid of workflow EntityId = Guid.Parse("B0A19CDD-88DF-E311-B8E5-6C3BE5A8B200") // Guid of record }; var executeWorkflowResponse =(ExecuteWorkflowResponse)orgService.Execute(executeWorkflowRequest);
Hello,
I don't think that's doable. Can you please describe your scenario?
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156