web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

plugin is triggered by workflowaction - how to handle exception in plugin

(0) ShareShare
ReportReport
Posted on by 76

Hi Community!

I have a complicated situation.

On a form on entity A in CRM 2016 a workflowAction is triggered by clicking on a ribbon-button (via javascript)

In this workflowAction an entity B (totally different type) is updated. On this entity a plugin is registered (only on update). This plugin itself calls a webservice. If webservice-call fails the first workflowaction has to handle this but shouldn't throw an error.

If i throw an InvalidPluginExecutionException in plugin for entity B if webservicecall fails I get "There is no active transaction....." 

I also need the failed message the webservice returns, to show what happened, to the user.

How can I handle this?

thx in advance

©a-x-i

I have the same question (0)
  • PabloCRP Profile Picture
    1,088 on at
    RE: plugin is triggered by workflowaction - how to handle exception in plugin

    Hi,

    base on how it's build your solution, I wouldn't trow an exception in the plugin, unless a core functionality failed, but for know what happed with the external webservice I'd log in entity B the Response, could be in one memo field and then with the javascript validate the status of the response and like if the response has a status different from 200 then show the body of the response. here and example of what the plugin would log.

    {
    "statuscode":200, //400,401,etc. 
    "message":"All done!"//Your data it's wrong, no authorized, etc.
    }

    regards.

  • Axi Bachlechner Profile Picture
    76 on at
    RE: plugin is triggered by workflowaction - how to handle exception in plugin

    thank you for your reponse.

    The problem is, that I don't want to save entity B if the webserviceCall wasn't successful. So an exception is the only way to trigger a rollback.

    a-x-i

  • nyiicco Profile Picture
    10 on at
    RE: plugin is triggered by workflowaction - how to handle exception in plugin

    The web service call executes first before you update entity B. Before you execute the update, you can check first the response code of the web service, if the code is not "200" means there is an error encountered. So instead of proceeding with the update, save the web service response to other entity which the user can check.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 186

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 130 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans