Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Open specific form based on field value in Dataverse record.

(0) ShareShare
ReportReport
Posted on by 621

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:
  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: Open specific form based on field value in Dataverse record.

    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.

     

  • ctedesco3307 Profile Picture
    621 on at
    Re: Open specific form based on field value in Dataverse record.

    @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! 

  • Verified answer
    Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: Open specific form based on field value in Dataverse record.

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,618 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,962 Most Valuable Professional

Leaderboard