cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jkling
Level: Powered On

Problem with ForAll and Patch

Good Afternoon,

 

I need a little help.  I've followed the instructions from this document and I'm not getting errors in my code, but there is no data being written to my SP list.

https://powerapps.microsoft.com/en-us/blog/bulk-update-using-forall-and-patch/

The code below builds a collection when a user enrolls in a particular course.  The collection (colEnrollItems) is a list of records filtered by the users' email address (GvarUserEmail) and the TrainingKey (galCourseDetails.Selected.TrainingKey) which is a specific training course for which they are registered.  There was a bug that introduced duplicates into my dataset and my current patch process was only updating the first record.  I need to update all records that might exist in the dataset for this email and training key combo. 

This code is supposed to compare the source file (Training - Master Output).ID to the "NewID" in the before mentioned collection.  It will update three fields in the source file and loop through all of the records picked up in the collection. 

 

ClearCollect(colEnrollItems,AddColumns(Filter('Training - Master Output',TrainingKey = galCourseDetails.Selected.TrainingKey,SelfEmail = GvarUserEmail),"NewID",ID));
ForAll(colEnrollItems,
    Patch('Training - Master Output',
        LookUp('Training - Master Output',ID in colEnrollItems.NewID),
        {
            ScheduleID: ThisItem.ID,
            OfferingChosen: 1,
            Registered:1
        }
    )
)

 

I am not getting any errors in the code.  The problem is that the patch isn't writing to the SP list at all.  I've tried using both options below and neither of them worked. 

 

LookUp('Training - Master Output',ID = colEnrollItems.NewID)

LookUp('Training - Master Output',ID = colEnrollItems[@ID])

 

I'm at a loss, I would love some ideas from the community.  

Thanks!

Joe

 

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,348)