web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Open specific form bas...
Power Apps
Answered

Open specific form based on field value in Dataverse record.

(0) ShareShare
ReportReport
Posted on by 950

Is there a way to get a specific form to open when user clicks on record, depending on the value of another field?

For example

- if WIRS_Request says 'Marketing Presentation' then when user clicks on WIRSID 269, formMP would open

- if WIRS_Request says 'Config Design Support ' then when user clicks on WIRSID 269, formCDS would open.... 

 

ctedesco3307_0-1686756312837.png

Thanks in advance 

 

An alternative design approach could be to show /  hide tabs based on same field value .... 

- if WIRS_Request says 'Marketing Presentation' - Config would be hidden 

- if WIRS_Request says 'Config Design Support '  - Marketing presentation would be hidden

 

ctedesco3307_0-1686757066498.png

 

Categories:
I have the same question (0)
  • Verified answer
    Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    Hi @ctedesco3307 ,

     

    This is not possible out of the box, but you could achieve this by creating a java script web resource, and then having it run on the OnLoad event on your Form:

     

    Amik_0-1687340811887.png

     

     

    In the below example, I have two tabs, tab_one and tab_two.

     

    Amik_1-1687340920386.png

     

     

    To show/hide either tab based on the value of a text field for example, you could use:

     

    function HideTab() {
     var textFieldValue = Xrm.Page.getAttribute('logical_field_name_for_WIRS_Request').getValue();
     
     if (textFieldValue === "Marketing Promotion") {
     Xrm.Page.ui.tabs.get('tab_one').setVisible(false);
     Xrm.Page.ui.tabs.get('tab_two').setVisible(true);
     } else if (textFieldValue === "Config Design Support") {
     Xrm.Page.ui.tabs.get('tab_one').setVisible(true);
     Xrm.Page.ui.tabs.get('tab_two').setVisible(false);
     }
     }

     


    Similar logic can be applied where you have more than one Main Form for the same entity, although I have personally not tested this. 

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

  • ctedesco3307 Profile Picture
    950 on at

    @Amik   This is great advice - thank you -GOT it working - had to add the function name to the event handler!  

     

    This is awesome! Thx!! 

     

    Form 

    ctedesco3307_0-1687351484135.png

    ctedesco3307_5-1687352315200.png

     

    ctedesco3307_4-1687351728878.png

     

     

    Code:

    function HideTab() {
    var textFieldValue = Xrm.Page.getAttribute('ctq_wirs_request').getValue();

    if (textFieldValue === "Marketing Presentation") {
    Xrm.Page.ui.tabs.get('tab_3').setVisible(true);
    Xrm.Page.ui.tabs.get('tab_2').setVisible(false);
    } else if (textFieldValue === "Configuration Design Support") {
    Xrm.Page.ui.tabs.get('tab_3').setVisible(false);
    Xrm.Page.ui.tabs.get('tab_2').setVisible(true);
    }
    }

    ctedesco3307_1-1687351562637.pngctedesco3307_2-1687351576577.png

     

     

    ctedesco3307_3-1687351602778.png

    Do I need to enter anything in function? I tried it like this and not working.  Thank you! 

  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    Hi @ctedesco3307 ,

     

    Yes. You will need to pass the function name (I have named it "HideTab"), as well as check "Pass execution context as first parameter".

     

    Amik_0-1687354706272.png

     

    Remember to publish all customisations in the Solution.

     

     

    Amik_1-1687354758025.png

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 320 Most Valuable Professional

#2
11manish Profile Picture

11manish 210

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard