Make the editable fields un-editable based on a condition in NAV | CloudFronts

Make the editable fields un-editable based on a condition in NAV

Introduction:

This article explains how to change the editable fields into un-editable fields based on certain condition. In this article, we make the page fields un-editable on change of status from Open to Released. For example, the fields like No., Description etc. will be freeze when the NAV page status changes to Released.

Pre-requisites:

Microsoft Dynamics NAV 2017.

Steps

  1. We create a Boolean field in the Global variable (Ctrl + G) in the NAV page and sets the property by clicking on (Shift + F4) of the boolean variable ‘IncludeInDataset’ to yes. This property is set to yes when the variable is used as the value of the Editable property, enabled property, visible property or StyleExpr property.
  2. Now we select the fields of the NAV which needs to be changed to un-editable and set the enabled properties of the field to the Boolean field name.
  3. Now in the C/AL code (F9), in the ‘OnAfterGetCurrRecord’ we place a condition that if the status is Released then the Boolean field ‘fieldeditable’ is set to false this will freeze the fields and only if the status is open the ‘fieldeditable’ will be set to true. By default the value of the boolean variable is true.
  4. Below is the screenshot of the NAV page with status open.

    Below in the screenshot , the approval status is ‘released’.

     


Share Story :

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close