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
Community Champion
Community Champion

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,678)