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:
"item/statecode": 0,
"item/statuscode": 100000000
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!
Dave
Solved! Go to Solution.
Hi @DavidMLCarr1 ,
The Record Item should be defined in JSON format as follows.
{
"name": "Test Name",
"statecode":1
}
Hope this helps.
Sik
Hi @DavidMLCarr1 ,
The Record Item should be defined in JSON format as follows.
{
"name": "Test Name",
"statecode":1
}
Hope this helps.
Sik
Sik!
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!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
30 | |
29 | |
29 | |
20 | |
11 |