23 Mar’17

D365 Business CentralMake 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’.

     

    Written by

    Chris D'Silva

    Software Developer

2 thoughts on “Make the editable fields un-editable based on a condition in NAV”

  1. HI thanks.

    if we wanted to hide a field on the page(eg. in Item card the Unit Cost should not be visible to the set of users). can you give me some sample

    1. Hi Srinivasan,

      Similar to the blog post, you need use User Setup,

      UserSetup.RESET;
      UserSetup.SETRANGE(“User ID”,USERID);
      UserSetup.SETRANGE(“Finance User”,TRUE); // here FINANCE user is a user in the User setup
      IF UserSetup.FINDFIRST THEN
      // your condition (False or true)

      Please check and let us know if you still face the issue.

Leave a Reply

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

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Reading more then 10K records in D3FOE OData API

    11 July’ 2018

    Introduction: We all know Dynamics 365 Finance and Operations has limitation of 10K records to be fetched at a time usi...

    Read more
  • Paging in D365 Customer Engagement v9.0

    10 July’ 2018

    Introduction: The Xrm.retrieveMultipleRecords method is used to retrieve a collection of records in Dynamics 365 Custom...

    Read more
  • Set up Dynamics 365 connection in Microsoft Social Engagement

    10 July’ 2018

    Introduction: This blog explains how to Set up Dynamics 365 connection in Microsoft Social Engagement. Steps to be follo...

    Read more
  • Voice of the Customer failed to install

    10 July’ 2018

    Introduction: Many people face issues in installing Voice of Customer solution on v9 environment and trying repeatedly ...

    Read more
  • Scribe Insight AX as a Web Service Find Block issue

    10 July’ 2018

    Introduction: If we need to look up for any value from AX then we do it by using a Find Block in Scribe Insight Eg: Basi...

    Read more