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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Warning message instead of exception

(0) ShareShare
ReportReport
Posted on by 821

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

I have the same question (0)
  • Verified answer
    Ben Thompson Profile Picture
    6,350 on at

    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.

  • Satish1024 Profile Picture
    107 on at

    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

  • Community Member Profile Picture
    on at

    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

  • Ben Thompson Profile Picture
    6,350 on at

    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...

  • gman0104 Profile Picture
    821 on at

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

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans