cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SushReus
Regular Visitor

Need to Update Share point List - Lookup Column using Patch in

Hi ,

 

I Have two lists Employees And Cities. There s A Lookup Column City in Employees which looks upto Column City in Cities.

 

On the Click of Update in Application . The Vlaue in the Tetx Box Near to The update should Update the DropDown Column City which is a lookup Column . Please let me know how the Patch Function should be Written . 

9 REPLIES 9
yashag2255
Dual Super User II
Dual Super User II

Hi @SushReus 

 

Try using the below expression:
Patch(Employees, LookUp(Employees,Title = TextInput4.Text),
{
    City:{Id: LookUp(Cities,Title = TextInput9.Text).ID,Value:LookUp(Cities,Title = TextInput9.Text).Title}
})
Here, I have created a similar scenario to patch the updates.
TextInput4 holds the employee Name, TextInput9 is the textbox beside Submit button to hold the new Value. 
As per my Employees SP list, I have stored Names in the title, so if you want to match with some other column, please update the column name in lookup query. 
MicrosoftTeams-image (106).png

Hope this Helps!

 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
v-yuxima-msft
Community Support
Community Support

Hi @SushReus 

 

Could you please test with @yashag2255 's suggestion?

Is it solve your issue?

 

Best Regards.

Yumia

The City Column in Share point List . Is it a look up column - Drop Down ? 

 

There is no error in the Function But after I Click on Update . There s nothing Updated in Share point List.


@yashag2255 wrote:

Hi @SushReus 

 

Try using the below expression:
Patch(Employees, LookUp(Employees,Title = TextInput4.Text),
{
    City:{Id: LookUp(Cities,Title = TextInput9.Text).ID,Value:LookUp(Cities,Title = TextInput9.Text).Title}
})
Here, I have created a similar scenario to patch the updates.
TextInput4 holds the employee Name, TextInput9 is the textbox beside Submit button to hold the new Value. 
As per my Employees SP list, I have stored Names in the title, so if you want to match with some other column, please update the column name in lookup query. 
MicrosoftTeams-image (106).png

Hope this Helps!

 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you l
 
 

 


 

Hi Yuxima,

 

It is not yet resolved can you please help me out.


@v-yuxima-msft wrote:

Hi @SushReus 

 

Could you please test with @yashag2255 's suggestion?

Is it solve your issue?

 

Best Regards.

Yumia


 

yashag2255
Dual Super User II
Dual Super User II

@SushReus 

 

Yes, City is a column of type choices.
 
Please share details about your SP list and the type of column, through this we will be able to help you better.
 
 

Hi Yash,

 

The CIty Column in Employees SP List is a lookup column which is from another SP List Cities . 

yashag2255
Dual Super User II
Dual Super User II

HI @SushReus 

 

Please share the formula for OnSelect property of your button. I tried the same scenario as yours and it was updating successfully, so might be possible it is some minor formula level mistake.

Patch(Employees, LookUp(Employees,Title = TextInput1.Text),
{
City:{Id: LookUp(Cities,Title = TextCol.Text).ID,Value:LookUp(Cities,Title = TextCol.Text).Title}
})

 

and 

 

Patch( Employees , ThisItem , { Title : TextInput1.Text , Colour : Dropdown1.Selected , Department : TextDept.Text , Dist : TextColor.Text, Town : TextCol.Text })

 

 

I would Require another Help 

 

Need to Update a look up column for the below given Scenario

 

I want to Update my SharePoint List HELP DESK (Column - Category which is a look up column)  using Patch with the Detail I give in Category Text Box whose value is dependent on Drop Down ddCategoryType . (Have a look at the screenshots)

 

Drop Down ddCategoryType is populated from SharePoint List CategoryOptions 

 

HelpDeskSPList.png

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,657)