cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
fs92
Helper I
Helper I

Model Driven Apps Different Form based on Optionset value

Hello,

 

I have implemented a project-based solution for the web.

A field "Project Type" is used to choose between Agile or Enterprise Waterfall Project as an example.

Based on this selection different forms should be visible. The reason is that some project types do not need as many fields as others.

What is the best way to archive this?

 

Cheers

 

1 ACCEPTED SOLUTION

Accepted Solutions

so there are two ways to give people a different form experience in model driven apps:

1. use different forms based on security role

2. use javascript or business rules to show/hide values on the same form.

 

some other things to keep in mind:

-CDS remembers the last form a user uses for an entity--if you switch to a different form, your app will remember that next time you visit a record.

-Quick create forms are your friend--create a minimal form that has the project type field and project header, then you have more flexibility with the full record form and users won't see a bunch of things changing after selecting that field.

 

Your scenario is best addressed with a single form with conditional show/hide logic. This is either javascript or business rules.

Business Rules

https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-busines...https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-busines...

 

Javascript

Business rules are more accessible if you are not a developer, but they are limited. For example I can only hide/show one field at a time, so if there are 100 field differences I need to add all of those fields to my business rule. Javascript can easily hide/show entire sections or even tabs.

 

You can BTW use javascript on load of a form to conditionally switch to a different form https://neilparkhurst.com/2015/11/01/javascript-form-navigate/

I'm not a fan of this approach because it slows down the load process. I prefer a single form that has javascript logic to hide or show the appropriate sections to provide the fastest form load process in your model driven app.

 

@fs92  if this answers your question, please mark it a solution.

View solution in original post

2 REPLIES 2

so there are two ways to give people a different form experience in model driven apps:

1. use different forms based on security role

2. use javascript or business rules to show/hide values on the same form.

 

some other things to keep in mind:

-CDS remembers the last form a user uses for an entity--if you switch to a different form, your app will remember that next time you visit a record.

-Quick create forms are your friend--create a minimal form that has the project type field and project header, then you have more flexibility with the full record form and users won't see a bunch of things changing after selecting that field.

 

Your scenario is best addressed with a single form with conditional show/hide logic. This is either javascript or business rules.

Business Rules

https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-busines...https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-busines...

 

Javascript

Business rules are more accessible if you are not a developer, but they are limited. For example I can only hide/show one field at a time, so if there are 100 field differences I need to add all of those fields to my business rule. Javascript can easily hide/show entire sections or even tabs.

 

You can BTW use javascript on load of a form to conditionally switch to a different form https://neilparkhurst.com/2015/11/01/javascript-form-navigate/

I'm not a fan of this approach because it slows down the load process. I prefer a single form that has javascript logic to hide or show the appropriate sections to provide the fastest form load process in your model driven app.

 

@fs92  if this answers your question, please mark it a solution.

View solution in original post

Hi,

thank you for your help.

I selected the javascript method because there are 4 different forms with to many different fields...

One addtional question:

Based on an Url field I want to load a website into an Iframe. The trigger ist if a tab "Maps" is selected.

On the first switch to this tab an error will be thrown, because the main Iframe where I want to embed the site is not loaded. If I go back and reopen the Tab, the Iframe exists and the embedding works.

Is there a best practice for this kind of solutions?

 

Cheers

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,267)