cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
misc
Responsive Resident
Responsive Resident

Using LastSubmit & Patch to update a record - invalid argument type error

I have an app where I want users to be able to share the record they have just submitted with other users. I have taken the 'People' screen template for users to select the people they want to share with, I then want to patch the email addresses of these people to a column 'SharedWith' in the SharePoint list. 

 

I am struggling with patching the email address information to the record which was just submitted. 

 

I have tested that the LastSubmit.ID function is returning a number (the label with 141 shown in the screenshot below), but I still get the error, 'invalid argument type (number), expecting a Record value instead'

errorlastsubmit.png 

Patch(LAB01, NewFormFill.LastSubmit.ID, {SharedWith: ShareWithEmail.Text})

I don't know if this is relevant but I am testing this on the 'New' form; there is a separate Form with allows users to edit previously submitted records, ideally I want this button to be table to take from whichever was last completed (either NewFormFill or EditFormFill), and patch to the relevant record.

 

Also probably of note is that I have a hidden label 'ShareWithEmail' which has a conCat function which lists the emails in one place rather than taking them straight from the collection. I couldn't figure out how to just take the emails, so this seemed the easiest way at the time. I am probably wrong and look forward to being corrected if that's the case.

 

tldr; how do I Patch to the last submitted record?

 

1 ACCEPTED SOLUTION

Accepted Solutions
misc
Responsive Resident
Responsive Resident

I'm such an idiot.

 

I didn't need the .ID so the function 

 

Patch(LAB01, NewFormFill.LastSubmit, {SharedWith: ShareWithEmail.Text})

 

now works fine.

 

I can't figure out how to delete this thread so I'm going to leave it up for my own shame and perhaps it will help others. 

View solution in original post

2 REPLIES 2
misc
Responsive Resident
Responsive Resident

I'm such an idiot.

 

I didn't need the .ID so the function 

 

Patch(LAB01, NewFormFill.LastSubmit, {SharedWith: ShareWithEmail.Text})

 

now works fine.

 

I can't figure out how to delete this thread so I'm going to leave it up for my own shame and perhaps it will help others. 

pagonza
Community Support
Community Support

Hello @misc, thank you the information! 

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,661)