Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

What is and how to use InvalidPluginExecutionException

Posted on by

Hello All Expert,

How to use InvalidPluginExecutionException and where the error message will get logged and where the exception will be shown?

*This post is locked for comments

  • Saddamk206 Profile Picture
    Saddamk206 777 on at
    RE: What is and how to use InvalidPluginExecutionException

    Hi,

    We can throw an exception and display a message.

    throw new InvalidPluginExecutionException("Message here....");

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: What is and how to use InvalidPluginExecutionException

    This class is used to show a user friendly custom error message. If you want to show a custom message to the user, you can use this class as it will show your message only with the heading as Business Process Error.

  • Suggested answer
    Gopalan Bhuvanesh Profile Picture
    Gopalan Bhuvanesh 11,397 on at
    RE: What is and how to use InvalidPluginExecutionException

    Hi

    InvalidPluginExecutionException is a class derived from Exception class. So, you can use in the same way as you throw any exception.

    This represents an exception that occurred during plug-in execution. When thrown by a plug-in, the Microsoft Dynamics 365 platform displays the exception message in a dialog (as Business Process Error) of the Web application.

    You can also use InvalidPluginExecutionException for debugging purpose during development. For example, to find out the Guid of a record you can throw that value as a message in the exception. Plugin stops running and you would get the error message with the Guid value.

    Example:

    throw new InvalidPluginExecutionException("The name already exists");

    There are many constructors available, please refer the following:

    [View:https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.invalidpluginexecutionexception.aspx:750:50]

  • Suggested answer
    M.Azwar Alam Profile Picture
    M.Azwar Alam on at
    RE: What is and how to use InvalidPluginExecutionException

    Hi you can check following link for handling exceptions in plugin

    msdn.microsoft.com/.../gg334685.aspx

    Mark answer as verified, if it works for you

  • Suggested answer
    MNarmeen Profile Picture
    MNarmeen 1,846 on at
    RE: What is and how to use InvalidPluginExecutionException

    Catch the exception and it will give you an option to download the error log in Business Process Error Dialog Box.

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: What is and how to use InvalidPluginExecutionException

    Hi,

    You could use InvalidPluginExecutionException as follows.

    catch(Exception ex)
    {
    throw new InvalidPluginExecutionException("Your message");
    }

    This message will be displayed as a Business Process Error pop-up window.

    Hope this helps.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans