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

Patch formula help

Hi, 
Can you please help me with the below scenario. Lists built on SharePoint.

 

List 1: Employee Information, Location field is Managed Metadata.

List 2: Company Store Order, Location field is Single line of Text.

 

On Form 1 Submit ( Employee Information), I want to write to Company Store Order using On Success.. Location does not work with the  error, "The type of this argument does not match the expected type. The type text was found."

 

ForAll(
ExpenseCollection,
Patch(
'Company Store Order Form',
Defaults('Company Store Order Form'),
{
Title: LineItem,
Quantity: LineQuantity,
Price:LineCost,
Size:LineSize,
MasterID:Form1.LastSubmit.ID,
EName:Form1.LastSubmit.Title,
PhoneNumber:Form1.LastSubmit.PhoneNumber,
Location:Form1.LastSubmit.Location.Selected
}
)
)

 

Any help is appreciated.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

6 REPLIES 6
eka24
Super User III
Super User III

Remove the SELECTED on the location:

ForAll(
ExpenseCollection,
Patch(
'Company Store Order Form',
Defaults('Company Store Order Form'),
{
Title: LineItem,
Quantity: LineQuantity,
Price:LineCost,
Size:LineSize,
MasterID:Form1.LastSubmit.ID,
EName:Form1.LastSubmit.Title,
PhoneNumber:Form1.LastSubmit.PhoneNumber,
Location:Form1.LastSubmit.Location
}
)
)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Thanks, I tried that first. I get the same error. " The type of this argument "Location" does not match the expected type "Text". Found type "Record';

PBala_0-1595527457697.png

 

brendon-colburn
Microsoft
Microsoft

I'm not proficient on what "managed metadata" is in the world of SharePoint but this sounds like it could be similar to a JSON object.  If it is, then the error message you are receiving is accurate. You cannot set a text field to be equal to a value of type object.  I would think there's a few solutions to your problem:

  1. You could wrap the location in JSON() which will turn it into a text version of the JSON object.  You'd do this if you want to maintain the structure of the object in a text field
  2. Otherwise drill deeper into the object using "." dot notation to get to an attribute(s) of the object that is of type Text.

 

Hope this helps!

ah yes I just saw your latest screenshot... Record = JSON Object try what I suggested.

Thank you very much. Can you please provide me some resources to achieve option 1.

 

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (926)