Power Community

Power Community

Show/Hide Model-Driven App Forms Tabs Based on Fields Data Values



Use Case: 

We have a Dataverse Table Form with three tabs (Sections), and we want to guide the users to fill the data fields in one tab at a time before moving to the next tab. Using BPF, we can achieve this via the stages, but this example shows how we can utilize Web Resources and JavaScript to interact with the Dataverse Forms data and controls.  


I have a Dataverse Table called Customers, and I have the Main Form as below:


I have the Customers Table Form that has three tabs as below:



We need when the form load, to hide all Tabs except the Customer Tab. To do this, we will use a web resource as our Event Handler for the On Load Event:


As you can see, I have an event handler, but here is how we can create one. First, you need to have your JavaScript file ready. Below is my JavaScript File:


Next, you will click on the + to Add Event Handler as below:


In the above step, I will click on the Edit Library and follow the below steps to create a web resource:


  1. Click Select to Upload the JavaSctript File
  2. Give a Name for the Web Resource
  3. Save and Publish

After this, we are ready to set up the handler:


For this use case, we are also creating an Event Handler for some Data fields, and this Handler will be executed when the values of those fields change. We are using the same Web Resource, and I have built the JavaScript function to accommodate those other Event Handlers. We will repeat the below step for the: Customer Full Name Field in the Customer Tab, Street Address Field, and Postal Code Field in the Address Tab. In doing so, we will ensure that users have to enter the customer name before entering the address information and enter the address information before entering the email address. But what is beautiful here is the whole tab will disappear until our condition is met.


This post was originally published on this site

- Advertisement -spot_img


Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Refresh Dynamics 365 CRM Subgrid from Embedded Canvas App

In Microsoft Dynamics 365, the ability to embed Canvas Apps brings the power of Canvas Apps to their model-driven forms. Recently,...

More Articles Like This

- Advertisement -spot_img