Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Warning message instead of exception

Posted on by 815

I have been using the throw new InvalidPluginExecutionException which prevent a record from being created upon a certain condition but now the customer just want a warning message displayed but the record created, Is there a way to just display a warning message instead of an exception from a plugin.

Your advice would be great.

Thanks G

*This post is locked for comments

  • gman0104 Profile Picture
    gman0104 815 on at
    RE: Warning message instead of exception

    Thanks Ben I had a feeling there was no simple way.

  • Ben Thompson Profile Picture
    Ben Thompson 6,350 on at
    RE: Warning message instead of exception

    No the invalidpluginexception only handles errors - in which case the plugin will rollback the entire create / update transaction and an error message is displayed by  Dynamics' front end.

    Hence my statement that if you don't want the system to error with a message displayed you need to handle it in an entirely different way. One method is the one I suggested above which I have implemented in the past...

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Warning message instead of exception

    So this functions obviously in the event that you test this typically, however in the test environment it doesn't.

    Regards: Maria Levis

    Assignment Writing Service UK

  • Satish1024 Profile Picture
    Satish1024 107 on at
    RE: Warning message instead of exception

    I faced the similar issue with one of my customers. Unfortunately, there is no way you can make it look like a warning. InvalidPluginExecution exception does not  accept any such custom arguments. 

    Thanks

    Satish Reddy

    Dynamics 365 Architect and Trainer

    Microsoft Dynamics 365 Developer Training

  • Verified answer
    Ben Thompson Profile Picture
    Ben Thompson 6,350 on at
    RE: Warning message instead of exception

    Sadly not, without some separate work as the user interface and backends are now very separated and the only time things propagate back up is for full errors. 

    You can however do it using the following:-

    1) add a text field to the entity and make it a hidden field in the form

    2) depending on the result of the plugin either set the field to be empty or put an error message in it.

    3) Add some javascript that runs on page load (& reload when the page is saved) to check if the field has the alert message in it and if it does show the message.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans