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"
Solved! Go to Solution.
Hi @dennisb88 ,
Maybe you could try:
ForAll(
col_HoursToApprove As TableA,
Patch(
Hours,
LookUp(Hours,TableA.HoursId = HoursId),
{Approved:"Yes"}
)
)
Best Regards,
Bof
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"})
)
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
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
205 | |
97 | |
60 | |
51 | |
48 |
User | Count |
---|---|
255 | |
158 | |
87 | |
79 | |
59 |