I am in the process of creating a flow which, upon the trigger activating, sends a prompt to a user.
The user selects a response, and then the flow sends a message in the appropriate channel. The prompt items come from the list channels action. I can use body('ListChannels')?['value]
to parse the response. The response is an array with each object looking like:
{
"id":"",
"displayName":"General",
"description":"Used to test in-development features",
"email":"",
"webUrl":""
}
I want to reduce
each object to just the displayName
key and use the resulting as the inputs for the next action, this is the accepted input for that action: ["General", "Channel2", "Channel3"]
Is there a way to convert this using the provided expressions/actions for power automate? I also need to use the response to lookup the corresponding array entry "id" for sending a message to that channel.
One possibility is to use looping and control statements to perform 'reduce' and 'lookup' actions:
For reduce : Initialize variable(s) (array) first and push the lookup value to the array(s):
Since the input for the next action requires options that are readable to the user we have to use the channel name.
For lookup : Loop through the original object array and compare each object channel name to your query value:
The user response is stored in selectedResponse
. We can loop through each item from the original list channels response and compare this to each objects channel name. If there is a match. We can use the current items id
as the argument to the "Post your own adaptive card" action.
Result :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.