I have two lists and I wanted to submit some data into the first list (projects), then get that record and “link” it in a lookup column, with a new record in my second list (phases).
Pretty standard parent:child or linked records by a ‘foreign key’ type setup (even though they say we shouldn’t use SharePoint as a database).
Naturally I used the LastSubmit property to try to get the previously saved record, but I was having a difficult time finding the correct syntax to update the lookup columns in the second list.
I used a standard input form & button to submit the form data into the first list, and I then wanted to “patch” a new record into the second list.
Here is the code I ended up using for the patch function:
phase:"Train & Implement",
The phase, StartYear, StartTerm … etc fields, are just normal text fields in the phase list – so no magic there.
The part of the code I was having issues with was that Project: field.
Just for more information, I also have the ID (Project:ID) and approval (Project:approval) fields as secondary lookup columns in the phases list, but I only have to update the main lookup column (Project) in the PowerApps patch function and then they are automatically filled in.
Incidentally, I removed the odata.type field & it still submits and saves the fields just fine; but I’ll just keep it here as a reference.
Works great, and I hope it helps you.