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

Posted On March 23, 2017 by Admin Posted in 

Since Microsoft Dynamics NAV upgrade is available now, it is crucial for you as a company to go for it and get the update. Microsoft Dynamics NAV is an ERP software. ERP stands for Enterprise Resource Planning. Companies can increase the efficiency of their staff as well as their productivity when they use this particular ERP software. 

Especially, small and medium companies can get a good return on the investment if they invest in this particular software. Here are some of the departments in your organization that is going to benefit well when you use ERP software:

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.

    1. 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.

    1. 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.

Below is the screenshot of the NAV page with status open.

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


Share Story :