locked
how to show only custom error message in Business Process Error in Microsoft Dynamic CRM 2015 online RRS feed

  • Question

  • any idea? how to show only custom error message in Business Process Error in Microsoft Dynamic CRM 2015 online when plugin code throw any error


    blog: <a href="http://technologynotesforyou.wordpress.com">http://technologynotesforyou.wordpress.com</a> | skype: ali.net.pk

    Wednesday, May 20, 2015 11:52 AM

All replies

  • You would have to wrap the executing code in a Try...Catch block.  In the catch, you can throw an InvalidPluginExecutionException and modify the message to whatever you like.

    try
    {
        // Execute code here
    }
    catch(InvalidPluginExecutionException ex)
    {
        throw new InvalidPluginExecutionException("Error :: " + ex.Message);
    }

    Wednesday, May 20, 2015 5:39 PM
  • I try InvalidPluginExecutionException but they did not show custom message in business process error as error sent by HttpWebResponse method in my plugin code.

    Also extra text shown in business process error when plugin assembly registered in sandbox mode as I am generate new ApplicationException and throw it.

    any idea how to remove that extra text in my custom error message?


    blog: <a href="http://technologynotesforyou.wordpress.com">http://technologynotesforyou.wordpress.com</a> | skype: ali.net.pk

    Thursday, May 21, 2015 8:55 AM
  • I guess I am confused here.  Are you trying to show something specific to the user when they save a record?  Here is a StackOverflow question that might be similar to yours.  

    http://stackoverflow.com/questions/16593626/how-to-send-alert-to-user-via-plugin-without-using-invalidpluginexecutionexcepti

    It basically says that you could try to check for errors in the OnSave event with JavaScript as an alternative?

    Thursday, May 21, 2015 1:53 PM