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
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 (1,296)