{"id":4367,"date":"2017-01-24T17:02:00","date_gmt":"2017-01-24T11:32:00","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=4367"},"modified":"2017-01-24T17:02:00","modified_gmt":"2017-01-24T11:32:00","slug":"set-default-price-list-field-on-product-as-read-only-in-dynamics-crm","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2017\/01\/set-default-price-list-field-on-product-as-read-only-in-dynamics-crm\/","title":{"rendered":"Set Default Price List field on Product as Read-Only in Dynamics CRM"},"content":{"rendered":"<p><strong>Introduction:<\/strong><\/p>\n<p>In Dynamics CRM\/365, we set the Default Price List on Product to define the calculation for Pricing that needs to be applied to the respective product. So there could be a business case where we may need to disallow a user from editing the default price list on the product.<\/p>\n<p><strong>The First Solution:<\/strong><\/p>\n<p>We can achieve this by making the Default Price List on Product as Read-Only through customizations by using Field Properties or by creating a Business Rule.<\/p>\n<p>As you can see in the below screenshot, this solution doesn\u2019t work.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-4363\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/01\/Set-Default-Price-List-field-on-Product-as-Read-Only-in-Dynamics-CRM1-1024x528.jpg\" alt=\"Set Default Price List field on Product as Read-Only in Dynamics CRM\" width=\"665\" height=\"342\" \/><\/p>\n<p>The field \u201cDefault Price List\u201d is not locked<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-4364\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/01\/Set-Default-Price-List-field-on-Product-as-Read-Only-in-Dynamics-CRM2-1024x273.jpg\" alt=\"Set Default Price List field on Product as Read-Only in Dynamics CRM\" width=\"665\" height=\"177\" \/><\/p>\n<p><strong>The Second Solution:<\/strong><\/p>\n<p>The alternative way to make this field as \u201cRead-Only\u201d is to write a script which would make it read-only. And call this on \u201cOnLoad\u201d event of the Product form.<\/p>\n<p>Below is the code snippet.<\/p>\n<p>Xrm.Page.ui.controls.get(&#8220;pricelevelid&#8221;).setDisabled (true);<\/p>\n<p>As you can see in the screenshot, we have created a JavaScript web resource and called a function to lock the field.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-4365\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/01\/Set-Default-Price-List-field-on-Product-as-Read-Only-in-Dynamics-CRM3-1024x518.jpg\" alt=\"Set Default Price List field on Product as Read-Only in Dynamics CRM\" width=\"665\" height=\"336\" \/><\/p>\n<p>Now it works and the field \u201cDefault Price List\u201d is locked and is read-only.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-4366\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/01\/Set-Default-Price-List-field-on-Product-as-Read-Only-in-Dynamics-CRM4-1024x337.jpg\" alt=\"Set Default Price List field on Product as Read-Only in Dynamics CRM\" width=\"665\" height=\"218\" \/><\/p>\n<p><strong>Conclusion: <\/strong>We cannot make the field \u201cdefault Price List\u201d on Product as Read-Only by setting it as Read-Only through field customizations. So the alternative way is to write a JavaScript code to make it Read-Only.<\/p>\n<p><a title=\"Gamification for Dynamics 365\/CRM \u2013 Take User Adoption to the next level!\" href=\"https:\/\/www.inogic.com\/blog\/2017\/01\/gamification-for-dynamics-365crm-take-user-adoption-to-the-next-level\/\" target=\"_blank\" rel=\"noopener noreferrer\">Wait no more! Gamification now available for Dynamics CRM\u00a0On-Prem &amp; Partner-Hosted Customers &#8211; Try Today!<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: In Dynamics CRM\/365, we set the Default Price List on Product to define the calculation for Pricing that needs to be applied to the respective product. So there could be a business case where we may need to disallow a user from editing the default price list on the product. The First Solution: We\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2017\/01\/set-default-price-list-field-on-product-as-read-only-in-dynamics-crm\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":4370,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[19,33],"tags":[1410,1591],"class_list":["post-4367","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-crm","category-javascript","tag-read-only-in-dynamics-crm","tag-set-default-price-list-field"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4367","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=4367"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4367\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/4370"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=4367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=4367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=4367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}