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.
Solved! Go to Solution.
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
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.
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...
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.
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
Thank you so much, this helped me a lot !!
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
205 | |
70 | |
51 | |
49 | |
20 |
User | Count |
---|---|
262 | |
120 | |
85 | |
80 | |
68 |