{"id":4650,"date":"2017-03-07T16:44:04","date_gmt":"2017-03-07T11:14:04","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=4650"},"modified":"2022-09-02T15:34:56","modified_gmt":"2022-09-02T10:04:56","slug":"plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/","title":{"rendered":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error"},"content":{"rendered":"<p style=\"text-align: justify;\"><strong>Introduction:<\/strong><\/p>\n<p style=\"text-align: justify;\">We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \u2018Approved\u2019 by showing an error message and sending an email to the owner of the account<\/p>\n<p style=\"text-align: justify;\"><strong>Issue?<\/strong><\/p>\n<p style=\"text-align: justify;\">As we know, to show an error message using plugin, we have to use InvalidPluginExecutionException.<\/p>\n<p style=\"text-align: justify;\">However, when we use InvalidPluginExecutionException it rollbacks any additional code executed on \u2018Pre-operation\u2019 and \u2018Post-operation\u2019 irrespective of it being \u2018Synchronous\u2019 or \u2018Asynchronous\u2019.<\/p>\n<p style=\"text-align: justify;\">The need over here was not just to throw an error and notify the user but also send an email\/log an error in the background.<\/p>\n<p style=\"text-align: justify;\">Throwing an exception in the plugin registered on \u201cPre-Operation\u201d or \u201cPost-Operation\u201d would also prevent the additional logging of the error message that was required.<\/p>\n<p style=\"text-align: justify;\"><strong>Solution:<\/strong><\/p>\n<p style=\"text-align: justify;\">We found an alternate way to achieve this by registering plugin on \u201cPre-Validation\u201d operation.<\/p>\n<p style=\"text-align: justify;\">Pre-validation operation allows processing the actions written, before throwing invalid plugin exception.<\/p>\n<p style=\"text-align: justify;\">We added a new plugin step and registered it as seen in the below screenshot:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter  wp-image-4652\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Plugin-Pre-validation-operation-to-Show-an-Error-Message-as-well-as-log-the-error.jpg\" alt=\"Plugin Pre-validation operation to Show an Error Message\" width=\"813\" height=\"513\" \/><\/p>\n<p>We have also written the code mentioned below to process actions before throwing invalid plugin exception:<\/p>\n<pre class=\"lang:default decode:true \">try{\r\nbool isApproved = false;\r\n                if (context.MessageName.ToLower() == \"associate\")\r\n                {\r\n                    \/\/validate relationship\r\n                    if (context.InputParameters.Contains(\"Relationship\"))\r\n                    {\r\n                       string relationship = context.InputParameters[\"Relationship\"].ToString();\r\n\r\n                    }\r\n                    \/\/check relationship\r\n                    if (relationship != \"relationshipname\")\r\n                    {\r\n                        return;\r\n                    }\r\n                    \r\n\/\/business logic execution\r\n\r\nif (!isApproved)\r\n                        {\r\n\t\t\t\/\/send email code\r\n\r\n\t\t\t\/\/throw error to prevent association\r\n\r\n\t\t\tthrow new InvalidPluginExecutionException(\" Account Status Reason needs to be Approved !!\");\t\r\n                 }\r\n\r\n                    }\r\n                }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><strong>Conclusion: <\/strong>Code in \u2018Pre-validation\u2019 is executed outside the transaction and therefore any updates made to the database in this stage persists and can therefore be used for error logging mechanism that needs to be implemented.<\/p>\n<h2 style=\"text-align: left;\"><div class=\"su-heading su-heading-style-default su-heading-align-center\" id=\"\" style=\"font-size:15px;margin-bottom:5px\"><div class=\"su-heading-inner\">Generate Your Own New Leads Within Microsoft Dynamics 365 CRM<\/div><\/div><\/h2>\n<p><em>Contact us for a <a href=\"https:\/\/www.maplytics.com\/maplytics-download\/?utm_source=highvisits&amp;utm_medium=technicalblog&amp;utm_campaign=hMaplytics\" target=\"_blank\" rel=\"noopener\">demo<\/a> to know more about how <a href=\"https:\/\/www.maplytics.com\/?utm_source=highvisits&amp;utm_medium=technicalblog&amp;utm_campaign=hMaplytics\" target=\"_blank\" rel=\"noopener\">Maplytics<\/a> can help you to generate new leads from within Microsoft Dynamics 365 CRM.<\/em><\/p>\n<p><em><a href=\"https:\/\/www.maplytics.com\/?utm_source=highvisits&amp;utm_medium=technicalblog&amp;utm_campaign=hMaplytics\" target=\"_blank\" rel=\"noopener\">Maplytics<\/a> is a 5-star rated, preferred business app on the <a href=\"https:\/\/appsource.microsoft.com\/en-us\/product\/dynamics-365\/inogic.f6f3c73f-29de-4fa8-a396-87ea8a07b6c4?tab=Overview\" target=\"_blank\" rel=\"noopener\">Microsoft AppSource<\/a> that is Certified for Microsoft Dynamics 365 (CfMD) and comes with powerful features like Appointment Planning, Sales Routing, Territory Management, Heat Maps, Geo-analytical Dashboards and more that empower organizations to add more value to their CRM data, improve sales &amp; service processes, and achieve high ROI.<\/em><\/p>\n<p><em>Get your <a href=\"https:\/\/www.maplytics.com\/maplytics-download\/?utm_source=highvisits&amp;utm_medium=technicalblog&amp;utm_campaign=hMaplytics\" target=\"_blank\" rel=\"noopener\">free trial<\/a> from our Website or <a href=\"https:\/\/appsource.microsoft.com\/en-us\/product\/dynamics-365\/inogic.f6f3c73f-29de-4fa8-a396-87ea8a07b6c4?tab=Overview\" target=\"_blank\" rel=\"noopener\">Microsoft AppSource<\/a>!<\/em><\/p>\n<p><em>&#8216;If data is the new oil, location intelligence is ??\u201d<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \u2018Approved\u2019 by showing an error message and sending an\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/\">Read More: Plugin Pre-validation Operation to Show an Error Message as well\u2026 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":4659,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,19,24,42],"tags":[1326],"class_list":["post-4650","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-365","category-dynamics-crm","category-dynamics-crm-2016","category-plugin","tag-plugin-pre-validation-operation"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"Introduction: We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \u2018Approved\u2019 by showing an error message and sending an\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Inogic\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Microsoft Dynamics 365 CRM Tips and Tricks - By Inogic\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error - Microsoft Dynamics 365 CRM Tips and Tricks\" \/>\n\t\t<meta property=\"og:description\" content=\"Introduction: We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \u2018Approved\u2019 by showing an error message and sending an\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Plugin-Pre-validation-operation-to-Show-an-Error-Message-as-well-as-log-the-error.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Plugin-Pre-validation-operation-to-Show-an-Error-Message-as-well-as-log-the-error.jpg\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2017-03-07T11:14:04+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-09-02T10:04:56+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inogicindia\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@inogic\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error - Microsoft Dynamics 365 CRM Tips and Tricks\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Introduction: We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \u2018Approved\u2019 by showing an error message and sending an\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@inogic\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Plugin-Pre-validation-operation-to-Show-an-Error-Message-as-well-as-log-the-error.jpg\" \/>\n\t\t<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t\t<meta name=\"twitter:data1\" content=\"Inogic\" \/>\n\t\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#blogposting\",\"name\":\"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error - Microsoft Dynamics 365 CRM Tips and Tricks\",\"headline\":\"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error\",\"author\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/03\\\/Plugin-Pre-validation-operationtoShow-an-Error-Message-as-well-as-Log-the-Error-1-1.png\",\"width\":150,\"height\":150,\"caption\":\"Plugin Pre-validation operationtoShow an Error Message as well as Log the Error\"},\"datePublished\":\"2017-03-07T16:44:04+05:30\",\"dateModified\":\"2022-09-02T15:34:56+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":7,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#webpage\"},\"articleSection\":\"Dynamics 365, Dynamics CRM, Dynamics CRM 2016, Plugin, Plugin Pre-validation operation\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.inogic.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-crm\\\/#listItem\",\"name\":\"Dynamics CRM\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-crm\\\/#listItem\",\"position\":2,\"name\":\"Dynamics CRM\",\"item\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-crm\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-crm\\\/dynamics-crm-2016\\\/#listItem\",\"name\":\"Dynamics CRM 2016\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-crm\\\/dynamics-crm-2016\\\/#listItem\",\"position\":3,\"name\":\"Dynamics CRM 2016\",\"item\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-crm\\\/dynamics-crm-2016\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#listItem\",\"name\":\"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-crm\\\/#listItem\",\"name\":\"Dynamics CRM\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#listItem\",\"position\":4,\"name\":\"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-crm\\\/dynamics-crm-2016\\\/#listItem\",\"name\":\"Dynamics CRM 2016\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\",\"name\":\"Microsoft Dynamics 365 CRM Tips and Tricks\",\"description\":\"By Inogic\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/inogic-logo.png\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#organizationLogo\",\"width\":1000,\"height\":325,\"caption\":\"inogic logo\"},\"image\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/inogicindia\",\"https:\\\/\\\/twitter.com\\\/inogic\",\"https:\\\/\\\/www.instagram.com\\\/inogicindia\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCM4V7ousgLSu1hbOEv4DUuQ\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/inogicindia\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/\",\"name\":\"Inogic\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/839d9ae7d2b941d2d09e91df322267a429821f2ce5494302b53bd5ca3679f1a0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Inogic\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#webpage\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/\",\"name\":\"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error - Microsoft Dynamics 365 CRM Tips and Tricks\",\"description\":\"Introduction: We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \\u2018Approved\\u2019 by showing an error message and sending an\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/03\\\/Plugin-Pre-validation-operationtoShow-an-Error-Message-as-well-as-Log-the-Error-1-1.png\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#mainImage\",\"width\":150,\"height\":150,\"caption\":\"Plugin Pre-validation operationtoShow an Error Message as well as Log the Error\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2017\\\/03\\\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\\\/#mainImage\"},\"datePublished\":\"2017-03-07T16:44:04+05:30\",\"dateModified\":\"2022-09-02T15:34:56+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/\",\"name\":\"Microsoft Dynamics 365 CRM Tips and Tricks\",\"alternateName\":\"Inogic\",\"description\":\"By Inogic\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error - Microsoft Dynamics 365 CRM Tips and Tricks","description":"Introduction: We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \u2018Approved\u2019 by showing an error message and sending an","canonical_url":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#blogposting","name":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error - Microsoft Dynamics 365 CRM Tips and Tricks","headline":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error","author":{"@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author"},"publisher":{"@id":"https:\/\/www.inogic.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Plugin-Pre-validation-operationtoShow-an-Error-Message-as-well-as-Log-the-Error-1-1.png","width":150,"height":150,"caption":"Plugin Pre-validation operationtoShow an Error Message as well as Log the Error"},"datePublished":"2017-03-07T16:44:04+05:30","dateModified":"2022-09-02T15:34:56+05:30","inLanguage":"en-US","commentCount":7,"mainEntityOfPage":{"@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#webpage"},"isPartOf":{"@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#webpage"},"articleSection":"Dynamics 365, Dynamics CRM, Dynamics CRM 2016, Plugin, Plugin Pre-validation operation"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.inogic.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/#listItem","name":"Dynamics CRM"}},{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/#listItem","position":2,"name":"Dynamics CRM","item":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/dynamics-crm-2016\/#listItem","name":"Dynamics CRM 2016"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/dynamics-crm-2016\/#listItem","position":3,"name":"Dynamics CRM 2016","item":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/dynamics-crm-2016\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#listItem","name":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/#listItem","name":"Dynamics CRM"}},{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#listItem","position":4,"name":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error","previousItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/dynamics-crm-2016\/#listItem","name":"Dynamics CRM 2016"}}]},{"@type":"Organization","@id":"https:\/\/www.inogic.com\/blog\/#organization","name":"Microsoft Dynamics 365 CRM Tips and Tricks","description":"By Inogic","url":"https:\/\/www.inogic.com\/blog\/","logo":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/02\/inogic-logo.png","@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#organizationLogo","width":1000,"height":325,"caption":"inogic logo"},"image":{"@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#organizationLogo"},"sameAs":["https:\/\/www.facebook.com\/inogicindia","https:\/\/twitter.com\/inogic","https:\/\/www.instagram.com\/inogicindia\/","https:\/\/www.youtube.com\/channel\/UCM4V7ousgLSu1hbOEv4DUuQ","https:\/\/www.linkedin.com\/company\/inogicindia"]},{"@type":"Person","@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author","url":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/","name":"Inogic","image":{"@type":"ImageObject","@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/839d9ae7d2b941d2d09e91df322267a429821f2ce5494302b53bd5ca3679f1a0?s=96&d=mm&r=g","width":96,"height":96,"caption":"Inogic"}},{"@type":"WebPage","@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#webpage","url":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/","name":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error - Microsoft Dynamics 365 CRM Tips and Tricks","description":"Introduction: We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \u2018Approved\u2019 by showing an error message and sending an","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.inogic.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#breadcrumblist"},"author":{"@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author"},"creator":{"@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Plugin-Pre-validation-operationtoShow-an-Error-Message-as-well-as-Log-the-Error-1-1.png","@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#mainImage","width":150,"height":150,"caption":"Plugin Pre-validation operationtoShow an Error Message as well as Log the Error"},"primaryImageOfPage":{"@id":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/#mainImage"},"datePublished":"2017-03-07T16:44:04+05:30","dateModified":"2022-09-02T15:34:56+05:30"},{"@type":"WebSite","@id":"https:\/\/www.inogic.com\/blog\/#website","url":"https:\/\/www.inogic.com\/blog\/","name":"Microsoft Dynamics 365 CRM Tips and Tricks","alternateName":"Inogic","description":"By Inogic","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.inogic.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Microsoft Dynamics 365 CRM Tips and Tricks - By Inogic","og:type":"article","og:title":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error - Microsoft Dynamics 365 CRM Tips and Tricks","og:description":"Introduction: We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \u2018Approved\u2019 by showing an error message and sending an","og:url":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/","og:image":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Plugin-Pre-validation-operation-to-Show-an-Error-Message-as-well-as-log-the-error.jpg","og:image:secure_url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Plugin-Pre-validation-operation-to-Show-an-Error-Message-as-well-as-log-the-error.jpg","article:published_time":"2017-03-07T11:14:04+00:00","article:modified_time":"2022-09-02T10:04:56+00:00","article:publisher":"https:\/\/www.facebook.com\/inogicindia","twitter:card":"summary_large_image","twitter:site":"@inogic","twitter:title":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error - Microsoft Dynamics 365 CRM Tips and Tricks","twitter:description":"Introduction: We had a business requirement, where we created a custom entity with a grid of Associated Accounts. Here, we wanted to restrict the Account while adding Accounts in the Associated View. We wanted to do this when the Account does not have the status reason \u2018Approved\u2019 by showing an error message and sending an","twitter:creator":"@inogic","twitter:image":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Plugin-Pre-validation-operation-to-Show-an-Error-Message-as-well-as-log-the-error.jpg","twitter:label1":"Written by","twitter:data1":"Inogic","twitter:label2":"Est. reading time","twitter:data2":"2 minutes"},"aioseo_meta_data":{"post_id":"4650","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-02-02 06:22:20","updated":"2025-07-04 02:51:04","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.inogic.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/\" title=\"Dynamics CRM\">Dynamics CRM<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/dynamics-crm-2016\/\" title=\"Dynamics CRM 2016\">Dynamics CRM 2016<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tPlugin Pre-validation Operation to Show an Error Message as well as Log the Error\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.inogic.com\/blog"},{"label":"Dynamics CRM","link":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/"},{"label":"Dynamics CRM 2016","link":"https:\/\/www.inogic.com\/blog\/category\/dynamics-crm\/dynamics-crm-2016\/"},{"label":"Plugin Pre-validation Operation to Show an Error Message as well as Log the Error","link":"https:\/\/www.inogic.com\/blog\/2017\/03\/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error\/"}],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4650","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=4650"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4650\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/4659"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=4650"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=4650"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=4650"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}