cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PMishra
New Member

Patching data from text field to lookup field

Hi,

There are two entities 'Contacts' and 'Appointments', in contacts field i already patched the two text fields, but i want that those two textfields should also patched into a single lookup column of 'Appointment' entity.

I am applying below formula to patch the data from the two textfields to a single lookup column,

If(varCheck=true,Patch(Contacts,Defaults(Contacts),{firstname:TextInput1.Text,lastname:TextInput1_1.Text,jobtitle:TextInput1_2.Text});Patch(Appointments,Defaults(Appointments),{Required:Concatenate(TextInput1.Text,TextInput1_1.Text});SubmitForm(Form3);ResetForm(Form3);

but i am getting the below error:

"the type of this argument(Required) does not match the expected type expected type 'Record'. Found type 'Text' "  

3 REPLIES 3
mdevaney
Super User
Super User

@PMishra
If I understand correctly you are trying to create a new row in the appointments table. The new row has a LookUp field “Required” that you are attempting to fill with two text strings.

LookUp columns require a record data type. Therefore filling it with two joined text strings is not possible. You will need to find another way to accomplish your goal.

Record type fields should typically be selected by the user through a ComboBox. Is there any opportunity to do that here?

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

v-monli-msft
Community Support
Community Support

Hi @PMishra ,

 

Check on below thread to see if it could help:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Unable-to-set-the-lookup-field-valu...

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @PMishra 

 

The issue here is that the lookup type column expects a record of a particular schema as per the lookup entity. When you are passing a concatenated string, this is not recognized as a valid input.

 

Based on the description shared by you, do you mean that you want to create a contact first and then add the same contact in the lookup column based on entered first name and last name?

 

Assuming that the above is correct, you can update the expressions as:

If(varCheck=true,Set(PatchedData,Patch(Contacts,Defaults(Contacts),{firstname:TextInput1.Text,lastname:TextInput1_1.Text,jobtitle:TextInput1_2.Text}));Patch(Appointments,Defaults(Appointments),{Required:LookUp(Choices(Appointments.Required),contactid =PatchedData.contactid)});SubmitForm(Form3);ResetForm(Form3);

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,741)