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 / Using Lookup for Condi...
Power Apps
Answered

Using Lookup for Conditional Visibility of Other Fields

(0) ShareShare
ReportReport
Posted on by 38

Hi Everyone,

 

I am struggling with leveraging lookup columns in app that I am building. I have a simple form based app where people can enter business travel information such as address, cities to be visited, contact details of hotel etc.

 

I want some fields in the form to be visible/required based on the value selected in the "DestinationCountry" field. The choices in this dropdown come from a separate list which contains a list of countries (the values in the dropdown) and a "CountryRiskLevel" choice column, where the choices are High, Medium, Low. Therefore, each country has a risk level associated with it.

 

Would it be possible to make some fields required/visible only when the user selects a country which has a risk level of "High"?

 

Thanks in advance!

Categories:
I have the same question (0)
  • MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at

    Yes. 

     

    The field that you want to be visible or required can have an IF statement. For example:

     

    Dropdown 1 > Go to the Visible Property > If(NameOfDestinationCountryField.Selected = "X", true, false)

     

    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful as can help others.

    LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
    Subscribe to my YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg



  • holtma Profile Picture
    38 on at

    Hi @phipps0218 , thanks for the suggestion!

    I am not sure if this will work in my scenario - maybe I can explain differently.

     

    The form is based on a simple SharePoint list (let's call it List1). However, the "DestinationCountry" column, which is feeding the dropdown choices in the form, is actually a lookup column to another list (let's call this list List2). List2 has two columns, one with a list of countries and the other with a risk level for each country (low, medium, high).

     

    What I want to do regarding conditional visible/required fields - when a user selects a "DestinationCountry", I would like the form to look up the risk level of that country and use that risk level to determine which fields are required.

     

    For example - if a user selects the USA as their destination country, the risk level will be "Low" and therefore they wont need to fill out the entire form. If the user were to select a country which has a "High" risk level, the form will need to make certain fields mandatory.

     

    I hope that this is clearer, thanks again for the help!

  • Verified answer
    Aapok Profile Picture
    on at

    You can try:

     

    On the onChange of your dropdown:

                                                                                                                                                 

    UpdateContext({varRiskLevel: First(Filter(List2, DestinationCountry = dropdown.Selected.Value)).RiskLevel})

    Note: Depending on how you fetch your data to the dropdown, Selected.Value might not be correct syntax. I also don't know the exact names of your columns, but this should give you a general idea how to achieve what you're trying to do.

     

    Then in each of your form items Visible property, you can use the Switch function to define their visibility:

    Switch(varRiskLevel, "Low", false, "Medium", false, "High", true)

     

    There might be errors in my syntax, I wasn't able to test the solution.

     

  • holtma Profile Picture
    38 on at

    Hi @Aapok - thank you, this works!

     

    I only had to make one small change as the "CountryRiskLevel" column in List2 is a choice column and not text. Therefore on the OnChange property of the country dropdown, I made the following adjustment:

     

    UpdateContext({varRiskLevel: First(Filter(List2, Title = Dropdown.Selected.Value)).CountryRiskLevel.Value})

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 833

#2
Valantis Profile Picture

Valantis 563

#3
Haque Profile Picture

Haque 383

Last 30 days Overall leaderboard