cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dennisb88
Responsive Resident
Responsive Resident

Bulk patch failed The requested operation is invalid. Server Response: Hours failed: The right side of the "Equal" operator must be a constant value

Hi all,

 

I've an app build on dataverse where I try to patch multiple records from a collection in to dataverse.

Because I want to update existing records, I use this formula:

ForAll(col_HoursToApprove,Patch(Hours,LookUp(Hours,ThisRecord.HoursId = HoursId),{Approved:"Yes"}))

The collection is a complete copy of the hours table.

 

When I try this patch, I get the following error:

"The requested operation is invalid. Server Response: Hours failed: The right side of the "Equal" operator must be a constant value"

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @dennisb88 ,

 

Maybe you could try:

 

ForAll(
  col_HoursToApprove As TableA,
  Patch(
     Hours,
     LookUp(Hours,TableA.HoursId = HoursId),
     {Approved:"Yes"}
  )
)

 

Best Regards,

Bof

View solution in original post

5 REPLIES 5
timl
Super User
Super User

@dennisb88 

If you reverse the 2 parts of the equality operation, does that make a difference?

ForAll(col_HoursToApprove,
       Patch(Hours,LookUp(Hours, HoursId=ThisRecord.HoursId),{Approved:"Yes"})
)
dennisb88
Responsive Resident
Responsive Resident

Hi @timl ,

 

Thank you for your reply. 

No that make not any difference.

v-bofeng-msft
Community Support
Community Support

Hi @dennisb88 ,

 

Maybe you could try:

 

ForAll(
  col_HoursToApprove As TableA,
  Patch(
     Hours,
     LookUp(Hours,TableA.HoursId = HoursId),
     {Approved:"Yes"}
  )
)

 

Best Regards,

Bof

Hi @v-bofeng-msft ,

 

Thanks, that's works like a charm!

 

One further question, Why does this method works and the version I try not? It's the same data.

 

Anyway thank you for your help.

Hi @dennisb88 ,

 

ThisItem and ThisRecord are great, but they only make the innermost record available.  In nested situations, it is impossible to reference the record in an outer scope. 

 

I think this link will help you a lot:
https://powerapps.microsoft.com/en-us/blog/formulas-thisrecord-as-and-sequence/

 

Best Regards,

Bof

Helpful resources

Announcements
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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,870)