Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Trigger workflow on a Plugin Exception

(0) ShareShare
ReportReport
Posted on by 25

Can we trigger a workflow once we get an exception from Plugin? 

  • Suggested answer
    RE: Trigger workflow on a Plugin Exception

    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.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Trigger workflow on a Plugin Exception

    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.

  • Sudharshini Profile Picture
    Sudharshini 25 on at
    RE: Trigger workflow on a Plugin Exception

    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?

  • Suggested answer
    Community D365 Profile Picture
    Community D365 5 on at
    RE: Trigger workflow on a Plugin Exception

    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); 
    

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Trigger workflow on a Plugin Exception

    Hello,

    I don't think that's doable. Can you please describe your scenario?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans