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 III
Super User III

@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.
yashag2255
Dual Super User II
Dual Super User II

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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (41,124)