cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yjamous
Advocate II
Advocate II

How to update lookup field

Hi

I'm trying to update a SharePoint List from a collection.

The SharePoint list has one lookup field.

So, when I'm collecting the items, I'm using the following code:

 

Collect(NoChargeItems,CollectionItems);

 

 

When I'm submitting the collection to add record to SharePoint, I'm using the following code:

 

Collect(
    CollectionItems,
    {
        ItemRequestID: DCValueRequestID.Text,
        ItemSMN: TextInputMaterialNumber.Text,
        ItemReference: TextInputItemReference.Text,
        ItemDescription: TextInputItemDescription.Text,
        ItemQTY: DropdownQTY.Selected.Value,
        ItemSpecialInstructions: TextInputSpecialInstruction.Text,
        LinkedRequestID: {Value:DCValueRequestID.Text} // THIS IS THE LOOKUP FIELD THAT I WANT TO UPDATE
    }
);

 

 

My problem is that the lookup field doesn't get updated. The lookup field (LinkedRequestItem) value comes from a TextInput field that I have in a form.

 

 

4 REPLIES 4
zmansuri
Super User
Super User

Lookup and Choice and People picker this are complex type columns. You can't patch it directly because it is not a value but the record itself.

Check this out:

Solved: How to patch a SharePoint Lookup Column - Power Platform Community (microsoft.com)

Thanks @zmansuri 

I saw this article. This article shows how to patch in case you have data coming from dropbox or combo box. The value I want to update the lookup field with comes from TextInput field. How would this work in this case?

 

Collect(
CollectionItems,
{
ItemRequestID: DCValueRequestID.Text,
ItemSMN: TextInputMaterialNumber.Text,
ItemReference: TextInputItemReference.Text,
ItemDescription: TextInputItemDescription.Text,
ItemQTY: DropdownQTY.Selected.Value,
ItemSpecialInstructions: TextInputSpecialInstruction.Text,
LinkedRequestID: {

'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",

Id:DCValueRequestID.Text,

Value:DCValueRequestID.Text}
}
);

 

================================================== OR Maybe this. Not Sure

Collect(
CollectionItems,
{
ItemRequestID: DCValueRequestID.Text,
ItemSMN: TextInputMaterialNumber.Text,
ItemReference: TextInputItemReference.Text,
ItemDescription: TextInputItemDescription.Text,
ItemQTY: DropdownQTY.Selected.Value,
ItemSpecialInstructions: TextInputSpecialInstruction.Text,
LinkedRequestID: {

'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",

Value:DCValueRequestID.Text

}
}
);

@zmansuri  unfortunately none of them worked, though the code didn't show any errors, but the field didn't update. It kept empty.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,883)