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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (19,271)