{"id":1207,"date":"2013-11-01T06:54:08","date_gmt":"2013-11-01T06:54:08","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=1207"},"modified":"2013-11-01T06:54:08","modified_gmt":"2013-11-01T06:54:08","slug":"apply-field-validations-without-writing-java-script-in-ms-crm-2013-part-2","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=1207","title":{"rendered":"Apply Field Validations without writing Java Script in MS CRM 2013 &#8211; Part 2"},"content":{"rendered":"<p>In our last post we discussed business rules and in this post we are going to show how we can create business rule in MS CRM 2013. To create business rule navigating to entity customization. Let\u2019s take a very simple example we want to validate if Relationship type is selected a \u201cConsultant\u201d we need to make industry field business required in account entity. If we need to implement this in JS code we need logic like below<\/p>\n<p style=\"text-align:left;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>if Relationship type value is consultant then <\/strong><\/p>\n<p style=\"text-align:left;\"><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 make Industry field required<\/strong><\/p>\n<p style=\"text-align:left;\"><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else<\/strong><\/p>\n<p style=\"text-align:left;\"><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Remove required from Industry field<\/strong><\/p>\n<p>In the same way we need to create two business rules for this, one to handle if part and other to handle else part, so let\u2019s design our business rule for this.<\/p>\n<ul>\n<li>Navigate to account entity customization and select business rule from left navigation.<\/li>\n<li>Provide label \u201cMake Industry required\u201d<\/li>\n<li>Add a condition using below settings:<\/li>\n<\/ul>\n<p><strong>Field<\/strong>: Relationship Type<\/p>\n<p><strong>Operator<\/strong>: Equals<\/p>\n<p><strong>Type<\/strong>: Value<\/p>\n<p><strong>Value<\/strong>: Consultant<\/p>\n<ul>\n<li>Click on \u201cCheck Mark\u201d to collapse condition section.<\/li>\n<li>Add action using below settings<\/li>\n<\/ul>\n<p><strong>Field<\/strong>: Industry<\/p>\n<p><strong>Status<\/strong>: Business Required<\/p>\n<ul>\n<li>Click on \u201cCheck Mark\u201d to collapse action section.<\/li>\n<li>Set scope for your business rule.<\/li>\n<li>Save and close business rule.<\/li>\n<li>Activate your business rule.<\/li>\n<\/ul>\n<p>Let\u2019s test our business rule navigate to Account entity and create new account and set Relationship type as \u201cConsultant\u201d it will make industry field required like below:<\/p>\n<p><a href=\"http:\/\/mahenderpal.files.wordpress.com\/2013\/11\/consultantrequred.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1208 aligncenter\" alt=\"CONSULTANTREQURED\" src=\"http:\/\/mahenderpal.files.wordpress.com\/2013\/11\/consultantrequred.png\" width=\"380\" height=\"105\" \/><\/a><\/p>\n<p>But if you will select some other value in Relationship type it will still keep industry field required like below:<\/p>\n<p><a href=\"http:\/\/mahenderpal.files.wordpress.com\/2013\/11\/stillrequired.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1209 aligncenter\" alt=\"stillrequired\" src=\"http:\/\/mahenderpal.files.wordpress.com\/2013\/11\/stillrequired.png\" width=\"398\" height=\"80\" \/><\/a><\/p>\n<p>To handle this we need to create another business rule to remove business required in case relationship value is different than consultant. Create new business rule using below configuration:<\/p>\n<p><a href=\"http:\/\/mahenderpal.files.wordpress.com\/2013\/11\/notrequired.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1210 aligncenter\" alt=\"Notrequired\" src=\"http:\/\/mahenderpal.files.wordpress.com\/2013\/11\/notrequired.png\" width=\"500\" height=\"239\" \/><\/a><\/p>\n<p>Activate your second business rule and open account record. Now when you will select some other value it will remove business required from industry field.<\/p>\n<p><b><a href=\"http:\/\/himbap.com\/\" target=\"_blank\">HIMBAP<\/a> | Need any help in MS CRM 2013 <a href=\"http:\/\/www.himbap.com\/contactus.aspx\">Contact US !!<\/a><\/b><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our last post we discussed business rules and in this post we are going to show how we can create business rule in MS CRM 2013. To create business rule navigating to entity customization. Let\u2019s take a very simple example we want to validate if Relationship type is selected a \u201cConsultant\u201d we need to make industry field business required&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=1207\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6,13],"tags":[37,115,118],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1207"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1207"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1207\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}