cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

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
Highlighted
Resolver I
Resolver I

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

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
Highlighted
Resolver I
Resolver I

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

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

Highlighted
Microsoft
Microsoft

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

Hello @misc, thank you the information! 

 

 

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,261)