25 Jul’17

D365 Business CentralDynamically hide and show fields according to a specific condition on a page in Dynamics NAV

Introduction:

We often have a requirement to dynamically hide or show fields on a page according to a certain condition. Setting visibility properties of the fields to ‘True’ or ‘False’ do not help as they do not work dynamically. They are only set when the page is opened initially.

In this article, I will be demonstrating the procedure to show or hide fields dynamically on a page according to a specific condition.

Pre-Requisite:

Microsoft Dynamics NAV 2017

Procedure:

This is the scenario that I was customizing. I was working on two types of contracts i.e. Rental and Lease contracts. The user has to select the contract type on the page. Now if the user selects ‘Rental Contract’ as the Contract Type then a certain set of fields should be visible to the user else, they should be hidden.

  1. The first step is to put all the fields that should be shown or hidden dynamically in a separate group on the page.

    In the above screenshot, I have put all the fields that should be shown or hidden dynamically when ‘Rental Contract’ is selected in ‘Contract Type’ field which is an option field consisting of OptionString ‘Rental Contract and Lease Contracts for Uber and Non-Uber drivers’ under ‘Rental details’ group.

  2. Next, go to the properties of the group that contains the fields which should be dynamically hidden or shown i.e. properties of ‘Rental details’ group.
  3. Now in the visible property section, define the condition that triggers the fields to be dynamically shown or hidden.
  4. So, I have set the condition that when ‘Contract Type’ equals ‘Rental Contract’ then only ‘Rental details’ group should be visible i.e. I have written the condition as below:
  5.  “Contract Type”=”Contract Type”::”Rental Contract”

    Below are the screenshots of my page:

    The above shows the three options available for contract type.

    So if Contract type ‘Lease contract for Non-Uber drivers’ or ‘Lease contract for Uber drivers’ is selected then the ‘Rental details’ group along the fields it contains are hidden.

    The above screenshot shows that only if ‘Rental Contract’ is selected as ‘Contract Type’, only then the Rental details group and the fields it contains becomes visible.

 

Written by

Team Member

CloudFronts

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