cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Auto Populate Lookup Field in Form based on a Gallery Selection

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Auto Populate Lookup Field in Form based on a Gallery Selection

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,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Auto Populate Lookup Field in Form based on a Gallery Selection

@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."

Highlighted
Frequent Visitor

Re: Auto Populate Lookup Field in Form based on a Gallery Selection

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!

 

Highlighted
Community Support
Community Support

Re: Auto Populate Lookup Field in Form based on a Gallery Selection

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,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (7,648)