web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching last submitte...
Power Apps
Unanswered

Patching last submitted record choice columns during OnSuccess

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi. I'm pulling my hair out. I've got a SP list custom form that's designed to create new records for employee changes. Two of these columns are Combobox controls that pull items from columns in another SP list. What I'm envisioning is the user filling out the form, clicking submit, the two Combobox values being put into a Collection, the form submits, then the Patch function will pull the last submitted form and patch the two columns in question with the values stored in the Collection before clearing it out and resetting the form.

 

aaronjmill_0-1656609741533.png

 

Here's my OnSelect (forgive the lack of accessible names) :

Collect(Collection3, {'New Department': DataCardValue7.Selected, 'Status Change': DataCardValue6.Selected});
SubmitForm(SharePointForm1)

 

And this is my OnSuccess for the form (SharePointForm1):

Patch('Employee Changes',LookUp('Employee Changes', SharePointForm1.LastSubmit), {'New Department':Collection3.'New Department','Status Change':Collection3.'Status Change'})
;
Clear(Collection3)
;
Notify("Request successfully submitted!",NotificationType.Success);Navigate(MainPage,ScreenTransition.Fade)

 

I get this runtime error when trying to submit:

aaronjmill_2-1656609834337.png

 

 

I know something is wrong with the Lookup, but I don't know the proper syntax to fix it. I'm also pretty positive I'm calling on the Collection3 items incorrectly but again, I've had very little luck finding google results on my specific scenario. Any help you can provide would be great. Thank you!

Categories:
I have the same question (0)
  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @Anonymous 

     

    do you want to create a new record in 'Employee Changes' list?

    Or you want to update an existing record there?

    If update, how your master SP list relates to 'Employee Changes' list?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for the reply. Trying to create a new record, then patch two fields in that same record immediately afterwards. The master list is the 'Employee Changes' list.

  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @Anonymous 

     

    'New Department' and 'Status Change' are text columns?

     

    if yes:

     

    Collect(Collection3, {'New Department': DataCardValue7.Selected.Value, 'Status Change': DataCardValue6.Selected.Value});
    SubmitForm(SharePointForm1)

     

     

     

    Patch('Employee Changes',LookUp('Employee Changes', ID = SharePointForm1.LastSubmit.ID), {'New Department':First(Collection3).'New Department','Status Change': First(Collection3).'Status Change'})

     

     

     

    EDITED: you may need replace .Value with a name of info you want to be used.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#2
11manish Profile Picture

11manish 212

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard