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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch SharePoint List ...
Power Apps
Unanswered

Patch SharePoint List then get last ID doesn't works correct

(0) ShareShare
ReportReport
Posted on by 860

Hi,

 

I'm using Patch to update a SharePoint List.

After saving the list, I want to call a flow with the just created List ID as parameter.

Unfortunately I don't get the new created ID: I get the ID the second last ID.

 

So my code is:

Patch(
 TestList,
 Defaults(TestList),
 Form1.Updates
);

Set(varID,Last(TestList).ID);

 

I also already tried to set a "Refresh(TestList)" in between, but it didn't solved the problem.
If I use the same function in really small Apps, it works fine. So maybe it depends on the size of the SharePoint List?

My last option would be to use UpdateForm/LastSubmit, but that would force me to "redesign" many steps.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @max81 ,

    Have you tried

    Patch(
     TestList,
     Defaults(TestList),
     Form1.Updates
    );
    Refresh(TestList);
    Set(varID,Last(TestList).ID);

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Mx81 Profile Picture
    860 on at

    Hi @WarrenBelz : yes, I tried. But without success.

     

    I also tried:

    Patch(
     TestList,
     Defaults(TestList),
     Form1.Updates
    );
    Refresh(TestList);
    Set(varID,Last(TestList).ID);
    Refresh(TestList);
    Set(varID,Last(TestList).ID);

     

    Also without success. 

    My workaround: first make an Submit with just the required field, than use LastSubmit to get the ID then Patch the missing fields.
    But I still hope that there is a solution...

  • eka24 Profile Picture
    20,923 on at
    Try
    Patch(
    TestList,
    Defaults(TestList),
    Form1.Updates
    );
    Refresh (TestList);
    ClearCollect(MyTest,TestList);
    Set(varID,Last(MyTest).ID)
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @max81 ,

    The reason I did not mention LastSubmit was that you were using a Patch instead of SubmitForm, which triggers that value.

    Going back to your original post, you mentioned calling a Flow. You can return as (generally), the last item a value to Power Apps which can be the ID of what you have posted, however the posting would have to be from the Flow, not the Patch. This also uses a Flow quota which from what I see would be unnecessary simply to write data to a list.

    You could also consider a (hidden) timer after the refresh for (say) five seconds before you do the Collect.,

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Verified answer
    v-siky-msft Profile Picture
    on at

    Hi @max81 ,

     

     

    I think this should work for you. It can not only complete the patch function but also save the ID of the current patched record in the variable

     

    Set(varID, Patch(TestList,Defaults(TestList),Form1.Updates).ID)

     

    Sik

  • Mx81 Profile Picture
    860 on at

    @v-siky-msft perfect. I didn't know that.

     

    @WarrenBelz thanks also for your help.

  • Community Power Platform Member Profile Picture
    on at

    Thank you so much, this helped me a lot !!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard