cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
P_SA
Helper V
Helper V

Patch forall updates the first record only

Hello Folks, I have struggling to debug this error.  I am using forall patch to update my CDS table connected to d365 via Dual write. However the function only updates the first record. I am trying to update the status in a gallery to "Approved" state.
Below is my function.

 

 

clearCollect(colinst,Gallery1_2.AllItems);

ForAll(RenameColumns(colinst, "eusw_emailid", "EEID"),
Patch([@'Information Barriers Instruction Users'],
LookUp([@'Information Barriers Instruction Users'],EmailId = EEID),
 {'Status (eusw_status)': 'Information Barrier Status'.Approved}))

 

 

 

I did a test on my side and collected the results of  forall  into a collection like below . in this collection "Test" I could see the status were changed to Approved for all the records, but in CDS I could just see one record updated. 

 

 

ClearCollect(colinst,Gallery1_2.AllItems);

ClearCollect(test,
ForAll(RenameColumns(colinst, "eusw_emailid", "EEID"),
Patch([@'Information Barriers Instruction Users'],
LookUp([@'Information Barriers Instruction Users'],EmailId = EEID),
 {'Status (eusw_status)': 'Information Barrier Status'.Approved})))

 

 

 Please suggest. 

 

1 REPLY 1
VijayTailor
Resident Rockstar
Resident Rockstar

Hi You can use Patch Like that ways, Hope your issue is reloved . No need to use the Lookup function in ForAll function

Concurrent(Notify("Updating Child Record, Please Wait",NotificationType.Error),
ForAll(
BackEndChildTitleUpdateBulk, //Collection
Patch(
ChildEntryBook,
ThisRecord,
{
Title: Text(
"TimeSheet_For_" & BackEndMasterID.'Week Start' & "_" & BackEndMasterID.'Week End ',
"[$-en-US]m/d/yyyy"
)
}
);

));
Notify("All Child Title Formate Updated Successfully",NotificationType.Success);Refresh(TimeSheetEntryBook);

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,768)