Earlier today, a colleague of mine who tends to spend his days developing Power Automate Flows lately showed me something that seemed confusing at first. Now having dug into it a bit more I think it makes sense, but let’s see what you think.
Here is a Flow where I have an HTTP Trigger, a Compose action, Initialize Variable action, and “send an email” action:
When trying to add dynamics content to the email body, I see Compose action outputs, but I don’t see the variable. I also see “name” and “value” from the http request json payload.
What’s interesting about all this is that:
- Presumably, email “body” is of “string” type
- Compose action is of “any” type
- “Name” and “Value” are of “string” type, too
As for the email “body”, I am not really sure how to verify the type there, but it’s a reasonable assumption.
I was not able to find that statement about “Compose” action in the PowerAutomate documentation, but here is what Logic Apps documentation has to say:
As for the Http request, here is the schema:
So, what if I changed the type of my variable to make it a “string”? I would not be able to use “body” from the Dynamic content to initialize it:
BUT. I would be able to use that variable for the email body:
Or I could just use “Compose”, since, the way I see it, it can take “any” type for input, and it produces “any” type for output. Which makes it compatible with any other type, and which is different from variables, since they are actually strongly-typed.
PS. Of course I might also use triggerBody() function to achieve the same result without using Compose, but what would I write about then?