Skip to main content

Posts

Showing posts from March, 2016

Custom plugin exception output for crm form

    I was playing with MS Dynamics Crm forms server side validation. The idea was to use a plugin for validation when a lot of calculation involved and JS is not an option. Actually this is a routine task.    The point here is how we display a response. There is only one way in crm to display a server side exception by throwing InvalidPluginExecutionException. It’s not bad if we could customize the output exception page and make it dynamic.    I’ve used an embedded file to get configurable html in the run time and have better error message design. I hope it will help you to improve the user experience and add a style to crm form. Here is the plugin code:     public class CustomErrorMessage : IPlugin     {         public void Execute( IServiceProvider serviceProvider)         {               string fileName = "CustomError.xml" ;               try             {                 throw new Exception ( "GO!" );             }