Hi, I would like to ask you something,
My question is more general. How to work with the current record which is processing in the ForAll loop. I'm quite stuck with that.
for better imagination lets assume that I have ForAll function in that function I need to let's say patch record. I need id of the current record in the for all function to use it in the patch function.
Sure we can do an example together 🙂
In the example our goal is to update several records currently having a Status of "Open" to the Status "Closed". We already have the ID of all records we want to update stored in a Collection called myRecords. See my sample code below.
ClearCollect(
myRecords,
{ID:1001},{ID:1201},{ID:1315},{ID:1467},{ID:1500}
);
To perform the patch we can use use this code. Do you notice how I have referenced the current ID being looped over by writing myRecords[@ID]. This technique is called disambiguation. The column ID exists in both myRecords and mySharePointList so we must tell PowerApps to look at myRecords using the square brackets otherwise it will just look at the ID column for the current scope of LOOKUP which is mySharePointList.
ForAll(
myRecords,
Patch(
mySharePointList,
LookUp(mySharePointList, ID: myRecords[@ID]),
{Status: "Closed"}
);
Let me know if you have any further questions.
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.