web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching Multi LookUp ...
Power Apps
Answered

Patching Multi LookUp Columns

(0) ShareShare
ReportReport
Posted on by 10

Hi all,

 

I am trying to use patch to insert records in sharepoint list. the columns are lookup BUT when I try to, only Column2 gets inserted and Column1 is blank.

 

 

SubmitForm('New Request Form');
Patch(DataSheet,
	Defaults(DataSheet),
	{
		Column1: {
			'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”,
			Id: LookUp(LookUpSheet, LookUpSheetColumn=LookUpSheetValue.Selected.Result, ID),
			Value: LookUpSheetValue.Selected.Result
		},
		Column2: {
			'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”,
			Id: ’New Request Form’.LastSubmit.ID,
			Value: ’New Request Form’.LastSubmit.ID
		}
	}
)

 

 

The weird thing is that when I comment out the SubmitForm, I see data on Column1 (and Column2 blank).

 

Any thoughts?

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @dhageuk ,

    That is because after submission, the control is no longer active and the values are not current - you can do this (I do not know the column name you are submitting to in the main list and have assumed .Value applies - if a Text field, delete this.

    Patch(DataSheet,
     Defaults(DataSheet),
     {
     Column1: 
     {
     Id: 
     LookUp(
     LookUpSheet, 
     LookUpSheetColumn = ’New Request Form’.LastSubmit.YourColumnName.Value,
     ).ID,
     Value: ’New Request Form’.LastSubmit.YourColumnName.Value
     },
     Column2: {
     Id: ’New Request Form’.LastSubmit.ID,
     Value: ’New Request Form’.LastSubmit.ID
     }
     }
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • dhageuk Profile Picture
    10 on at

    thanks @WarrenBelz 

    This:

     

    ’New Request Form’.LastSubmit.YourColumnName.Value

     

    Cannot be used as the column is not in the Form. I had to save the values before submitting the form. Is there a more elegant solution? Pls see below my solution that works.

     

    Set(tmpId, LookUp(LookUpSheet, LookUpSheetColumn=LookUpSheetValue.Selected.Result, ID));
    Set(tmpValue, LookUpSheetValue.Selected.Result);
    SubmitForm('New Request Form');
    Patch(DataSheet,
    	Defaults(DataSheet),
    	{
    		Column1: {
    			'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”,
    			Id: tempId,
    			Value: tempValue
    		},
    		Column2: {
    			'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”,
    			Id: ’New Request Form’.LastSubmit.ID,
    			Value: ’New Request Form’.LastSubmit.ID
    		}
    	}
    )

     

     

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @dhageuk ,

    Firstly, you do not need the '@odata.type' reference anymore and I was assuming the reason for it not working as what I posted, but you are saying this is not the case, but the value for some other reason does not exist after the form is saved. The option is exactly what you have done and pre-saved the values in Variables (you could just save the Value part and do the Id lookup in the patch, but that is probably less "elegant"). 

    The other question you maybe should ask yourself is why you are using lookup columns in the first place (unless you need them to interact directly with SharePoint in "edit in grid view") - they can be nothing but a burden in Power Apps and I simply do not use them.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard