I am writing a flow to generically clean up data (for example, delete any records that have been deactivated for 90 days.) I have a 'driving table' that I use a 'List records' action on. Each record in this table has a Fetch XML query defined (copied from advanced find, and placed into the Query String field). This FetchXML runs just fine inside of the List Records action, and returns the data from the entity specified in the driving table.
In the Apply to each loop, I want to update the (variable) entity, and set the status to 'Inactive'. (Set Statecode to 1, and Statuscode to 1, e.g.) (I realize the status codes for inactive can vary; I have another table I reference for each entity that identifies the proper code for that entity.)
If I 'hard-code' the Entity in the Update statement, all is well, as I can pass the GUID from the current record I am looping through, and set the status to Inactive. This is not generic though. (I would have to write a switch on entity, and craft a different update statement for each.... Not the end of the world, but everything else in this flow IS generic!)
What I'd LIKE to do is specify the entity generically. When I do that (and this makes perfect sense) the system doesn't know what fields to display for the (variable) entity. I am able to specify the variable entity and the variable GUID for that entity, but I don't know what to put in "Record item" to update the statecode to 1.
I looked at the peek code for the 'generic' and 'account' updates, (couldn't paste it in here, got an "invalid HTML" message) and see that, e.g., the non-generic one shows:
I tried dozens of different combinations of that, but most don't pass the expression syntax validation. If it does, and I run the job, it hangs. The entire Apply for loop this update statement is in is all greyed out.
So my asks are:
(a) Is it possible to supply a variable entity to the CDS update record action?
(b) If so, could you please provide the syntax for the "Record Item" that will set the (variable) entities statecode to 1?
Many Thanks in advance!
Solved! Go to Solution.
Fan-freaking-tastic! Works perfectly. I'm one step away from making this update generic, and functional.
If you like my Visionary Rules Power App, https://appsource.microsoft.com/en-us/product/dynamics-365/visionary-software.13646115-0934-4695-976...
I'll cut you a heckuva deal!
Thanks so much, and have a great weekend!
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
Many congratulations to the Season 1 2021 Flownaut Crew!
Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.
Check out the community blog page where you can find valuable learning material from community and product team members!