cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
daruom
Helper II
Helper II

Problem with relationships and Patch function

Hello,

I can't use relationships in PowerApps.

I have 3 lists: "Product", "Order" and "ProductOrder".

 

Order listOrder list

"Product" and "Order" only contain the "Title" column with required value.

In "Product", I insert a record to perform the tests.

 

ProductOrder listProductOrder list"ProductOrder" contains 2 columns. their type is "Search" with required value. This search points to the "Id" column of the "Product" and "Order" lists.

 

 

FkProductId fieldFkProductId field

 

 

 

 

I would like to insert a record in the "ProductOrder" list when I create a record in the "Order" list.

 

I have tried with the following formula :

 

Set(newId; Patch(Order; Defaults(Order); {Title: DataCardValue1.Text}).ID);;
Patch(ProductOrder; Defaults(ProductOrder); {FkProductId: 2 ;FkOrderId: newId})

 

 

Here is the error message: "The type of this argument 'FkOrderId' does not correspond to the expected type 'Record'. Found type 'Number'".

How do you manage relationships the right way ?

 

Thanks.

11 REPLIES 11
PaulD1
Super User
Super User

I'm going to indulge in a little moan here... If MS are going to push people into using SharePoint as a datasource (by requiring premium licensing for SQL and Dataverse) they could at least do something to 'fix' working with Value fields and LookUps.

The '@odata...' syntax is completely non-obvious/intuitive and not supported by intellisense, so the only way people can figure this out is by looking it up online.

Power Apps is supposed to be easy for 'non-devs' and yet this issue (which affects many people) has not been addressed for years while instead effort goes into adding Mixed Reality and other highly niche features.

Hello,

With your changes, I have 4 error messages:

"Invalid argument type. Expected record value but with a different schema."
"Incompatible type. The 'Id' column in the data source you are updating expects a 'Number' type and you are using an 'Error' type."
"Missing column. Your formula does not have a 'Value' column with a type of 'Text'.
"The 'Patch' function contains invalid arguments.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, 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!

Top Solution Authors
Top Kudoed Authors
Users online (1,255)