cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

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

 

 

0 REPLIES 0

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (13,971)