😲You are probabily thinking, "Huh?"
In short:
I have a Power Automate variable that contains the expression-code for a field or variable.
I want to get the value of the expression-coded variable.
Example:
Variable Name: "Replace With"
Value: @{triggerOutputs()?['body/Author/DisplayName']}
🌟Some Magical Operation 🌟
Output: The value of the expression-coded variable: "Jones, Thomas K"
Here is what I'm doing:
I have email message text stored in a variable: "Email Body"
The text contains [TAGS] that need to be replaced with data from the triggered list record.
[Name] is replaced with Created By field value.
[DueDate] is replaced with Next Due Date variable value.
I created a "Tag-Data" list with all the Tags and the extension-coded variable to replace it:
[Name] replaced with @{triggerOutputs()?['body/Author/DisplayName']}
[DueDate] replaced with @{variables('Next Due Date')}
The Flow (in English)
I have my message text (below) with the [TAGs] stored in the variable "Email Body":
"[Name], we need the information for [TaskName] by [DueDate] or your request will be canceled."
For-Each item in my Tag-Data list:
- The Tag is stored in the variable "Replace String"
- The Expression-code is stored in the variable "Replace With"
- COMPOSE = Replace([Email Body], [Replace String], [Replace With]
- Email Body = COMPOSE
End For-Each
The output I get is:
"@{triggerOutputs()?['body/Author/DisplayName']}, we need the information for @{variables('Task Name')} by @{variables('Next Due Date')} or your request will be canceled."
The output I want is:
"Jones, Thomas K, we need the information for End of Year Evaluation by June 7, 2022 or your request will be canceled."
Thoughts? Also, if you can think of a better way to do this, I'd be glad to hear it!