{"id":4308,"date":"2022-03-22T12:11:13","date_gmt":"2022-03-22T12:11:13","guid":{"rendered":"https:\/\/himbap.com\/blog\/?p=4308"},"modified":"2022-03-22T12:11:13","modified_gmt":"2022-03-22T12:11:13","slug":"options-for-locking-field-on-business-process-flow","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=4308","title":{"rendered":"Options for locking field on Business Process Flow"},"content":{"rendered":"<p><strong>Requirement<\/strong><br \/>\nField should be locked on the form as well as on the business process flow.<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/lock.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4310 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/lock-218x300.jpg\" alt=\"lock\" width=\"218\" height=\"300\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/lock-218x300.jpg 218w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/lock.jpg 514w\" sizes=\"(max-width: 218px) 100vw, 218px\" \/><\/a><\/p>\n<p><strong>Details<\/strong><br \/>\nSometimes we need to make field read only on the business process flow. Let&#8217;s see what options we have to make field read only on entity forms.<\/p>\n<p><strong>Using Field Behavior<\/strong><br \/>\nThis is the first and the easiest way of making field read only. When you select this option, your field will be read only by default.<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly1.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4309 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly1-300x107.jpg\" alt=\"readonly1\" width=\"300\" height=\"107\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly1-300x107.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly1.jpg 315w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nIf require we can write scripting to unlock it based on the condition. But while using this option if some field is available on the form and BPF (Business Process Flow) it does not make field read only in the BPF.<\/p>\n<p><strong>Using Scripting<\/strong><br \/>\nThis is another option which we can use to make field read only on the form as well as on the BPF. but you need to write different code for the field on the form and for the field on the BPF, like in below screen we have same field in both places and we have used different code to make them read only.<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly2.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4311 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly2-300x207.jpg\" alt=\"readonly2\" width=\"300\" height=\"207\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly2-300x207.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly2-1024x706.jpg 1024w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly2-624x430.jpg 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/03\/readonly2.jpg 1057w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Business Rule<\/strong><br \/>\nAnother option to make field read only using business rule, we can create business rule based on the condition if any and it will make field read only in both the places. While creating business rule we have to use some condition first after that we can use some action, for example let&#8217;s say we have field which we are calculating through code and want to keep this field read only always. We can put condition to check owner field value, if owner field contains data, we can use action to lock field.<\/p>\n<p><strong>Summary <\/strong><br \/>\nThis is how we can use different options to make field read only on the form as well as BPF, we can use any option based on requirement.<\/p>\n<p>Hope it will help someone !!<br \/>\n<strong>Keep learning and Keep Sharing !!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Requirement Field should be locked on the form as well as on the business process flow. Details Sometimes we need to make field read only on the business process flow. Let&#8217;s see what options we have to make field read only on entity forms. Using Field Behavior This is the first and the easiest way of making field read only&#8230;. <a href=\"https:\/\/himbap.com\/blog\/?p=4308\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":4310,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[402,6,7],"tags":[976,977,973,975,974],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4308"}],"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=4308"}],"version-history":[{"count":4,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4308\/revisions"}],"predecessor-version":[{"id":4315,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4308\/revisions\/4315"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/4310"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}