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

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

 Chris Dsilva   Leave a comment

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

     


    Liked it? Share it.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Time limit is exhausted. Please reload the CAPTCHA.