CDS Post Images and CDS Pre Images in PowerAutomate Flows

By | June 19, 2020

Full disclaimer… this post was triggered by what a fellow MVP, Olena Grischenko, wrote earlier today: 

I am all for plugins, I actually write them every daySmile But, then, should not there be some way to work with pre/post images in PowerAutomate? Without code?

And there is one, although “no code” solutions are not, always, the easiest:


Basically, we can set up CDS to send pre/post/target data to a queue in Azure Service Bus. It’s not a complicated process, you just need to follow the steps described here:

Just make sure to use json message format when setting up the integration:


Once that is done, you can start adding SDK steps. And, for those SDK steps, you can start adding pre/post images:


Let’s say that’s been done.

The next step would be creating a flow. PowerAutomate has a connector for Azure Service Bus:

So, set up the trigger:


The remaining part is all about parsing that json from the message queue. Unfortunately, there is no “native” regex capability in Flows, though there are a few third-party connectors there. I did not try those, pretty sure they would work, but this is where “no code” is not the same as “no fees”Smile

Instead, I just opted to tweak the regex custom connector which I blogged about some time ago:

Here is the code I used for the regex action this time:


Now, once there is a regex connector, I just need to add a couple of action to extract “name” field from the pre image:


And, also, to extract it from the post image:


This is where you may have to look at the json and figure out how to write that regex expression (might need to test it in the regex tester).

Once that is done, I can access both pre-image and post-image values of the “name” attribute. In my case, I simply sent an email to myself:


And, once the email came in, both value are there:


What are the caveats?

  • We need to create azure service bus queue
  • We can’t rely on the capabilities of the CDS connector. Although, plugin registration tool is a powerful tool, so this is really a problem for the next step
  • Since we do need to figure out how to parse that json

But, in either case, except for the regex connector, this is a no-code solution to the problem. Might actually be possible to just use a bunch of “substring” and “indexof” function calls to do the same, but it’s probably easier to just set up that custom regex connector (or to subscribe to one of those which are already available in Power Automate)

5 thoughts on “CDS Post Images and CDS Pre Images in PowerAutomate Flows