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

Patch with forall

I am having trouble with a forall and patch formula. Below is my code.

ForAll(Gallery1_1.AllItems,
Patch('Information Barriers Instruction Users',
'Instruction Id'= Label2.Text,
{'Status (eusw_status)' : 'Information Barrier Status'.Approved}))


Gallery items : Filter( 'Information Barriers Instruction Users', 'Instruction Id' = Label3.Text)
asssss.PNG
I am using a forall to loop through the items and update the status column ( an option set)  from draft to approved. I am assuming the problem is with the ID column( instruction id ). My datasource is CDS linked with F&O via dual write.  The table in F&O has an indexing where unique key is a combination of email and 'instruction id'.  Can someone please help me how to deal with this problem.?

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @P_SA ,

The correct syntax is as below, but what is Label2.Text - the value needs to be in the Gallery to identify the records that need to be Patched.

ForAll(
   Gallery1_1.AllItems,
   Patch(
      'Information Barriers Instruction Users',
      {'Instruction Id':Label2.Text),
      {'Status (eusw_status)' : 'Information Barrier Status'.Approved}
   )
)

 

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  ,  label2.text is the instruction id to identify the records.  I am not able to identify the records based on the instruction ID.  As i said earlier, the unique key is a combination of instruction id and email.. 

so when I try to patch with forall, i am struggling to identify the records based on the unique key. 

 

error.PNG

@P_SA ,

So is Label2 the email box shown in your post and what is it combined with to form the unique key? If for instance it was a number (I will call it ID) that is in the gallery data, you would do something like this

ForAll(
   Gallery1_1.AllItems,
   Patch(
      'Information Barriers Instruction Users',
      {'Instruction Id':ID&Label2.Text),
      {'Status (eusw_status)' : 'Information Barrier Status'.Approved}
   )
)

can you please explain exactly how you arrive at the unique key.

 

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 @P_SA ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,036)