Dependent OptionSets in a Canvas Power App for 1:N related CDS entities | Power Platform

Most useful scenarios is to create what we commonly call as “Dependent OptionSets” in Dynamics 365 context.

Scenario

Here, Country and State are 2 entities in CDS. Each Country has N states i.e. Country is a parent entity of State entity.
undefined

We’ll create 2 Drop-downs in a Canvas Power App i.e. 2 OptionSets namely Country and State that selection of Country will affect what should be populated in State entity. Simple!
undefined

Setting up your Drop-down controls

Let’s see how the drop-downs are set.

  1. Drop-down 1 is populated from Countries entity in CDS (Common Data Service)
    undefined

    undefined
  2. For State to be filtered based on the Country, we’ll use Filter() function to show records based on what Country is selected in Drop-down 1.
    For Items of the Dropdown2 control, we’ll write the below formula
    undefined
    undefined

    So, the Filter([EntityToPopulate], ‘[LookupFieldNameOfParent]’.[EntityOfParent]) = [DropdownControl].Selected.[GUIDFieldOfParentEntity])
    Sorry, it’s a little rough on the eyes!
  3. And it will give you the below. Select Country first
    undefined

    select your parent record
    undefined


    Then, the drop down will populate child records based on the Country. So the States will show up which have lookup to India as Country.
    undefined

And that was it!

Here are some more Canvas PowerApp posts you might want to look at –

  1. Restore older version of a Canvas Power App | Power Platform
  2. Implement character length validation in a Canvas Power App | Power Platform
  3. Logged In User details in a Canvas Power App
  4. Implementing Exit app, Logout and Confirm Exit features in a Canvas Power App
  5. Variables in Canvas Power Apps | Global and Context
  6. Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform
  7. Adding a Canvas PowerApp to Teams
  8. Sending Image from Canvas PowerApps to SharePoint Document Library using Flows

Hope this helps!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.