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 / Auto Populate Lookup F...
Power Apps
Unanswered

Auto Populate Lookup Field in Form based on a Gallery Selection

(1) ShareShare
ReportReport
Posted on by 21

I have two sharepoint lists.

 

First list is CustomerList - contains information about customers including ACCOUNTNAME (Column name Single line of Text)

 

Second list is ActivityList - has a Lookup column (AccountName) that points to the ACCOUNTNAME in the CustomerList

 

I have a Form for the new ActivityList that has a dropdown/search field for selecting the ACCOUNTNAME from the CustomerList

 

I have a gallery that displays records from the CustomerList that I filter with TextInputs.

 

What I want to have happen is when a User selects a record from the CustomerList Gallery the field in my ActivityList Form will autopopulate with the appropriate ACCOUNTNAME.

 

I've read a lot about this and cannot seem to find a good solution...help?

 

Thank you,

Dean

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @Doosan_Dean 
    I was reading your explanation of the issue and it says that "AccountName" is currently a LookUp column in ActivityList.  If this is true your gallery based ActivityList would already seem to have this information available.  All you would need to do is place a new label in the gallery and use this code in the Text property

     

    ThisItem.AccountName.Value


    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Doosan_Dean Profile Picture
    21 on at

    I'm sorry - I don't think I explained it right the first time - here goes...

     

    The Gallery is displaying records from the CustomerList

     

    The Form i'm working with is creating records that go to the ActivityList.

     

    The field in this Form for AccountName is a 'searchable' dropdown that's 'Items' are the ACCOUNTNAMES from the customer list. This is the field that I would like to have automatically populate when someone selects a record from the CustomerList Gallery.

     

    I have no Gallery displaying ActivityList records.

     

    Thank you for taking the time to help me!

     

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

    Hi @Doosan_Dean ï¼Œ

    Do you want to populate selecteditems in a combo box(lookup field) by selecting items in a gallery(the related list)?

    Could you tell me whether AccountName field in ActivityList  allow multiple choice?

    I've made a similar test for your reference:

    1)set gallery's Items:

    Filter(CustomerList,TextInput1.Text in ACCOUNTNAME)
    //gallery display CustomerList,filter gallery based on AccountName

    2)insert an edit form

    set the form's datasource:

    ActivityList

    set the form's DefaultMode:

    New

    Unlock AccountName datacard in the form

    3)If AccountName is single choice lookup field, set AccountName combo box's DefaultSelectedItems:

    {Value:Gallery1.Selected.ACCOUNTNAME,Id:Gallery1.Selected.ID}

    //the selected item in gallery will be the combo box's selected item

     

    If AccountName allow multiple value, set arrow button's OnSelect inside the gallery:

    Collect(accounts,{Value:Gallery1.Selected.ACCOUNTNAME,Id:Gallery1.Selected.ID})

    set AccountName combo box's DefaultSelectedItems:

    accounts

     //the selected items in gallery (including the previous selected) will be combo box's selected items

     

     

    Best regards,

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard