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 / Patch last created ite...
Power Apps
Unanswered

Patch last created item stopped working

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

 

I'm going crazy as I cannot figure out why my app has suddenly stopped working. My app collects data from people and then patches to a SP list. There are 4 separate forms, 3 of them are used for collecting data, 1 shows the collected data as a summary where people can make final changes before submitting. So, I have 2 separate buttons that patch the data. My summary form button works, but for some reason, despite working last week, my other button stopped working. It doesn't patch any data at all. I'm using a variable "LastCreatedID" to identify whether a user is already in the list or not. Here is the button function that's not working. 

 

Set(
 LastCreatedID,
 Patch(
 'SP List',
 If(
 IsBlank(LastCreatedID),
 Defaults('SPList'),
 LookUp(
 'SPList',
 ID = LastCreatedID
 )
 ),
 {
 'Name of the Person': appuser.FullName,
 Job: JobTitle.Text,
 'Official email address': appuser.Email,
 //There are around 20 fields that are used for patching data to SP
 },
 ProfileForm.Updates,
 WorkForm.Updates,
 SkillForm.Updates,
//These are the forms I use for collecting data
 SummaryForm.Updates//This is the form that I use for showing a summary
 ).ID
 )

 What is wrong with my function that it stopped working? As I mentioned, it's not patching any of the fields. 

Thanks,

Categories:
  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    • Do we need individual forms to submit if Summary has all the fields?
    • Create and Updating not working?
    • We may need to update the Summary form submission once the previous forms are submitted successfully

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks @StalinPonnusamy as always you are the real MVP 🙂 to answer your questions:

    - I actually preferred separating the forms to enhance the data collection experience, each form collects certain information about specific themes; personal life, work life, previous experiences etc. Technically, you are right, 1 form (the summary form) could've been enough, but I think this was a better user experience.

    - If you remember, it's my first app, so I'm not sure what is create and updating, can you elaborate?

    - Weirdly enough, the summary form and the button on the summary form is the only ones that actually work. I'm not sure if I need to update the summary form. As a test, I created a test button on the very first form that patches all the fields in the first form, but still no luck. It's extremely frustrating, as I said, I did not touch the app at all. I'm not sure what's going wrong here. Happy to provide more details!

     

    Thanks!

     

     

     

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    The first time is Create and the subsequent time updates.

     

    Does this application is creating a record but not updating? Or Even a first time, this is not working?

     

    For troubleshooting, Set the Notification OnSucess property of the Summary Form

    Notify("Form Saved Succesfully")

     

    Set OnFailure Property of the SummaryForm to

     If(
     !IsEmpty(Errors('SPList')),
     Notify(
     Concat(Errors('SPList'), Column&": "&Message),
     NotificationType.Error
     )
     )

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks @StalinPonnusamy 

     

    My test button patches the fields that I'm automatically gathering (I have an appuser function to gather User() details), the rest of the fields are not patched, so I'm not sure what's not working. I'm afraid your OnFailure function did not give any type of notification, I assume it's because technically there is no error?

     

    In my test, I figured out if I remove the "Updates" functions in my forms from my patch function, it works. What I don't understand is why? My app has been collecting data without any issues, suddenly stopped working and I'm only now realising removing ".updates" from my forms helps with my issue. I added these after your suggestion in another post, do you have any ideas?

     

    Thanks,

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    We try to separate the Patch and form Updates.

     

    Set(
     ItemCreatedOrUpdated,
     Patch(
     'SP List',
     If(
     IsBlank(LastCreatedID),
     Defaults('SPList'),
     LookUp(
     'SPList',
     ID = LastCreatedID
     )
     ),
     {
     'Name of the Person': appuser.FullName,
     Job: JobTitle.Text,
     'Official email address': appuser.Email,
     //There are around 20 fields that are used for patching data to SP
     }
     )
    );
    
    If(
     !IsEmpty(Errors('SPList')),
     Notify(
     Concat(Errors('SPList'), Column&": "&Message),
     NotificationType.Error
     ),
    Set(LastCreatedID, ItemCreatedOrUpdated.ID);
    Patch(
     'SP List',
     ItemCreatedOrUpdated,
     ProfileForm.Updates,
     WorkForm.Updates,
     SkillForm.Updates,
     SummaryForm.Updates//This is the form that I use for showing a summary
     )
     )

     
    Thanks,
    Stalin - Learn To Illuminate

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @StalinPonnusamy 

     

    Thanks for your answer. Before I go on with implementing your suggestion, I would like to verify something. According to your formula, there will be two separate variables: 

    ItemCreatedOrUpdated

    and my current one, 

    LastCreatedID

     

    I'm a little confused how they will interact with one another. Can you elaborate before I move on?

     

    Many thanks,

     

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    I introduced a new variable to reduce the code.

     

    ItemCreatedOrUpdated - Full Record
    LastCreatedID - Just ID (Unique)

     

    In the second patch condition instead of using 

    If(
     IsBlank(LastCreatedID),
     Defaults('SPList'),
     LookUp(
     'SPList',
     ID = LastCreatedID
     )
    ),
    
    Simply using 
    
    ItemCreatedOrUpdated

     Still, LastCreatedID should have a valid ID to use for any other screen.

     


    Thanks,
    Stalin - Learn To Illuminate

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 


    Please let us know if anything needs on your post. We can help with this.

    Please mark the post as Solved If I have answered your question.
    Please give it a Thumbs Up if you find the suggestion helpful

    Thanks,
    Stalin - Learn To Illuminate

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard