Hello all,
I do not think this is possible after some research and testing, but I wanted to see if anyone else has any tricks to do this. I have an array that looks like this:
[
{
"ManagerName": "ManagerName1",
"ManagerEmail": "ManagerEmail1"
},
{
"ManagerName": "ManagerName2",
"ManagerEmail": "ManagerEmail2"
},
{
"ManagerName": "ManagerName3",
"ManagerEmail": "ManagerEmail3"
}
]
I want the output to be this:
concat(
if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail1'), 'ManagerName1', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerName1'), 'ManagerName1', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail2'), 'ManagerName2', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerName2'), 'ManagerName2', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail3'), 'ManagerName3', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerName3'), 'ManagerName3', '')
)
I have tried using an apply to each loop to append an array, but when you output in a "Compose" action it is a string rather than a usable expression. Anyone have any ideas or is this truly not possible? I was just trying to simplify some of the expressions that require a manager name so that I can add or remove that data just from an array rather than in the expressions themselves.
In the last test, this was the output of my compose action:
concat(
if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail1'), 'ManagerName1', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerName1'), 'ManagerName1', '')if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail2'), 'ManagerName2', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerName2'), 'ManagerName2', '')if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail3'), 'ManagerName3', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerName3'), 'ManagerName3', '')
)
I appreciate any help!
Hello @v-yueyun-msft,
That is correct, I wanted to create an expression dynamically based on an array of information. This would just help reduce the amount of maintenance needed in some expressions that use manager names, I would be able to just edit the array rather than the 4 formulas.
Thank you anyway!
Hi , @PJS-Data-Admin
According to your description, you want to automatically generate a Power Automate expression and use it?
In my experience, you may not be able to achieve it due to expression can only be used in Expressions console in Power Automate.
Best Regards,
Yueyun Zhang
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1