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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set 2nd lookup field b...
Power Apps
Unanswered

Set 2nd lookup field based on value of a variable

(0) ShareShare
ReportReport
Posted on by 36

Hello,

Using the CDS connector connecting to D365, I'm attempting to auto set a 2nd lookup field based on value of a variable within my 1st lookup field.  Has anyone had success with this?  I'm basically defining a variable and attempting to perform an IF statement with my drop down lookup field, for example: If(myVar=1, [DDLValue]="Yes").

 

Also, I am using combobox controls for my lookup fields since I am using the CDS connector.  Does this provide any limitations on what I'm trying to accomplish?

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @msm8504 

    You need to consider looking at it from the opposite direction.  Controls consume (are bound) to properties rather than setting them directly.

    So, in the case of your DropDown, you'll want to look at the Default value. 

    Something like  If(myVar=1, "Yes") in the Default property of the DropDown would give you what you want.

     

    I hope this is helpful for you.

  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @msm8504 ,

    Could you please share a bit more about your scenario?

    Do you want to auto set the 2nd LookUp field value within your 1st LookUp field (ComboBox)?

     

    Based on the issue that you mentioned, I think there is something wrong with your Operation. Currently, within PowerApps, we could not assign or set a value to a property of another control within one control.

    Currently, you could consider set default value for the 2nd LookUp filed directly based on a variable within your Edit form.

     

    I have made a test on my side, please take a try with the following workaround (the TaskLists field on my side represents the 2nd LookUp field in your scenario😞8.JPG

    Set the Items property of the ComboBox within the TaskLists (LookUp field) data card to following:

    Choices([@Tasks].crba2_TaskLists_Task)

    On your side, you should set the Items property of the ComboBox within your 2nd LookUp Data card to following:

    Choices('YourEntity'.YourSecondLookUpField)

     

    Set the DefaultSelectedItems property of the ComboBox within the TaskLists (LookUp field) data card to following:

    If(
    myVar=1,
    LookUp(Choices([@Tasks].crba2_TaskLists_Task),'Primary Name' = "Task2"),
    Parent.Default
    )

    On your side, you should set the DefaultSelectedItems property of the ComboBox within your 2nd LookUp data card to following:

    If(
     myVar=1, 
     LookUp(Choices('YourEntity'.YourSecondLookUpField), 'Primary Name' = "A specific Value"), /* <-- Find the specific record from your Referenced Entity based on a specific value */
     Parent.Default
    )

    Note: The Referenced Entity represents the Entity your 2nd LookUp filed reference values from.

     

    Please take a try with the above solution, then check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    on at

    Thanks for posting in the community @msm8504 - can you review the above replies and update the thread if they were helpful? 

     

    Thank you,

     

    @Anonymous 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard