Hi everyone, just got into power automate recently. I've been able to integrate Microsoft forms into a sharepoint list, as well as teams channel updates. I'm having a scenario I thought I'd reach out to the community with.
Effectively, a form is filled to request paperwork for a project. We have a Teams Group, where channels are the different projects we are working on. The names of the channels are long in name, but there is a field in the form what will be a part of the long name. For example, in the form let's say the user enters a field with Apples. The channel name may be TodayIbuyApples. What I am looking to do is when the person fills in the form, and the specific field in the form the user in that field enters Apples, that it will post a teams message in the channel called TodayIbuyApples.
Similiary, if the person in the form puts Oranges, and there is a channel called TomorrowIeatOranges, powerautomate would find where Oranges is used in what channels in the main group, and apply the message to all channels that have Oranges in it.
I hope that is clear!
@mp117 You need to use an expression and the toLower() function to convert the Channel name to lower case. When you insert the toLower() function you may not be able to select the Channel Name dynamic content. If that happens, you'll need to use an expression to get the Channel Name dynamic content. If you aren't sure how to do that, refer to this section of the tutorial listed below.
7 Functions You Need to Know | ⚡️Expression Essentials: Part 1⚡️
In this section, I'll cover how to get dynamic content with an expression when the dynamic content you need isn't listed in the dynamic content menu.
In the full tutorial I cover 7 functions you need to know when getting started with expressions.
1️⃣ empty()
2️⃣ coalesce()
3️⃣ equals()
4️⃣ if()
5️⃣ concat()
6️⃣ length()
7️⃣ split()
I cover how to use these functions in expressions and I’ll also cover common mistakes when it comes to writing expressions and show you a few tips and tricks along the way.
As a beginner or even an intermediate flow builder—expressions can seem a bit complex at first, I’m going to try to simplify it for you. If you want to level up your flows by writing expressions—keep watching!
IN THIS VIDEO:
✅ What is an Expression?
✅ What is a Function?
✅ What Does Wrapping a Function Mean?
✅ How Do I Insert an Expression?
✅ How to Use a Compose action
✅ How to Navigate the Expression Builder with Arrow Keys
✅ How to use the Expression Tooltip
✅ Common Mistakes When Writing Expressions
✅ How to differentiate a null from an empty string
✅ How to Get Dynamic Content When it’s Not Listed
✅ How to Use a Get Item Action to Verify Dynamic Content Output
✅ How to Convert Strings to Lower Case
✅ How to Troubleshoot the if() Function
I think I got it working! Thanks for the help! Still hoping to see if theres a way that the search for the channel name doesnt need to be case sensitive
Hi @creativeopinion Sorry for the late reply, finally am getting back to this. I implemented your compose counter to verify the output is finding the text (i.e shows 1). As a side note, any way to make it not case sensitive?
Otherwise so I confirmed the output it 1, but I am still having trouble in the Apply to each step. Should I be removing the count check now if its trying to take the response from the previous step? And what should the 'Channel' be?
@mp117 I'd recommend removing the Apply to Each action all together until you can get the Filter Array action set up correctly. As stated in my prev post, I would recommend outputting the count of items returned from the Filter Array action in a Compose action.
To troubleshoot your Filter Array action you need to verify if any of your Channel Names (first value) contains the MS form value (second value). The contains operator is case sensitive.
To clarify, the Filter Array action is looking for the string of text in the second value field (the value from your form) to see if it is contained in the Channel Name.
You can insert a Compose action above the Filter Array action and store the value from the form and review it's output.
For more flow troubleshooting tips—check out this YT Tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows
In this Power Automate tutorial, I explore 5 frequently asked questions that pop up when troubleshooting a flow. If you’d like to to level up your Power Automate flow skills and learn how to troubleshoot your Power Automate flow—this tutorial is for you!
IN THIS VIDEO:
✅ How to troubleshoot a false Condition action result
✅ How to get dynamic content when it isn’t selectable from the list of dynamic content
✅ How to troubleshoot an Apply to Each action that isn’t looping through
✅ How to troubleshoot a skipped Apply to Each action
✅ How to troubleshoot a Filter Query
✅ How to use a SharePoint yes/no column in a Filter Query
✅ How to use Compose actions to troubleshoot a Power Automate flow
✅ How to troubleshoot multiple emails being sent
✅ How to troubleshoot multiple Teams messages being sent
@RobElliott Thanks Rob for the suggestion, unfortunetly I'll have more than 25 channels, they will keep growing and changing so this may limit me.
@creativeopinion I was able to get the array started, but it's failing when I try and call the channel name it has found. Any thoughts what I could be doing wrong?
I'm assuming that Body is what the channel that was found based on my Filter Array block.
@mp117 I would take a different, possibly simpler, approach to the one suggested by @creativeopinion and just use a switch control, a type of condition, that looks at just that 1 question and depending on the answer posts to the relevant channel. You can have up to 25 cases in each switch: case answer = Apples then post to Apples channel, case answer = Oranges then post to Oranges channel.
Rob
Los Gallardos
Principal Consultant, SharePoint, Forms and Power Platform, WSP Global (and classic 1967 Morris Traveller driver)
I'd recommend using a Manual trigger while you build and test your flow. You can replace it with the Automated trigger once you've confirmed your flow works and you are ready to go live.
Select your Form Id and insert a response id to use for testing purposes. Also, I always keep a copy of a manually triggered flow when it comes to MS Forms—this way I can easily troubleshoot the flow if I run into issues as well as make any modifications and test them first before adjusting the automated flow.
Add a List channels action to your flow.
In my Team I have a couple of channels with strings of text that match my choice fields in my form. In my demo I've purposely placed the strings of text inconsistently in each channel name as we'll be using the Filter Array action and it won't matter if the string of text is at the beginning, middle or end of the channel name.
For reference, I'll be using the output from this MS Form choice question to match it to a channel name from above.
The List Channels action will return an array of Channels from the selected Team. Add a Filter Array action to your flow to filter out the list of Channel names where the string of text from your MS Form (in my case it's a Choice field) is contained in the Channel name.
In the From field, insert the Channel List dynamic content. In the first value field, insert the Channel Name. Change the operator to contains and in the second value field insert the dynamic content from the Get response details action that contains the string of text you want to search—in my case it's the Single Choice question.
Whenever I use a Filter Array action, I always like to return the count of items returned in a Compose action. This is helpful when building a flow and can also be used to troubleshoot your flow. Insert a Compose action. Tip: Don't forget to rename your actions to keep your flow organized!
Add an Expression. Use the length() function.
Select the Dynamic content tab and insert the body dynamic content from the Filter Array action into the length() function.
Run a test. Review the outputs. My test response has Choice 1 selected.
The Filter Array action has filtered out the Channel where the Channel name contains Choice 1.
If your Filter Array action isn't returning any results you will need to troubleshoot. Keep in mind the values in the filter array action are case sensitive and will look for a string match. The choice options in the MS Form include a space after the word Choice.
For demo purposes—I've added two more channels one with Choice 1 in lower case, the other where there aren't any spaces in the channel name.
I've run another test. The Compose action still outputs 1.
Add a Condition action to your flow. If items have returned (aka there is number stored in the Compose action—that is not equal to 0), add the rest of your actions to the Yes branch. If not, do nothing.
... more to come. In the meantime, you might find these YT Tutorials helpful:
To learn more about how to use the Filter Array action, please refer to this YT Tutorial: Are you using the Microsoft Power Automate Filter Array Action wrong?
In this video tutorial I’ll show you 3 practical ways to use the Filter Array action and how to use it properly.
1️⃣ Cross-Referencing Data
2️⃣ Filtering by Key
3️⃣ Substring Matching
Did you know that the Condition action has a limit of 10 conditions? Although it might look like the Filter Array action can only accept one condition—this is not true. By using the advanced mode you can enter multiple conditions into a Filter Array action with an expression.
IN THIS VIDEO:
✅ 3 Ways to Use the Filter Array Action
✅ How to use the Scope Action to Group Actions
✅ How to Check the Number of Items returned from a Filter Array Action
✅ How to Cross-Reference Data in Excel with a SharePoint List
✅ How the Filter Array Action Works
✅ How to Access the Dynamic Content from a Filter Array Action
✅ How to Filter Items by a Key
✅ How to Filter Items by Matching a Substring
✅ How to Use Multiple Conditions in a Filter Array Action
-----
3 Mistakes YOU 🫵 are Making with the Apply to Each Action in your Microsoft Power Automate Flow
In this video tutorial I’ll go over how to avoid these common mistakes when using the Apply to Each action in a Power Automate flow:
1️⃣ Looping through a Single Item
2️⃣ Creating Unnecessary Nested Loops
3️⃣ Looping through an Unfiltered Array
At the end of the video I share a few helpful insights when it comes to using the Apply to Each action in your flow.
IN THIS VIDEO:
✅ How to avoid the Apply to Each action with a single item array
✅ How to use the item() function to access dynamic content in an array
✅ How to prevent unnecessary nested Apply to Each action loops
✅ How to use the Select action
✅ How to convert an array to a string with the Select action
✅How to use the Filter Query field
✅ How to count the number of items in an array
✅ How to use a condition control
✅ How to use the concurrency control
✅ How to set a top count
✅ How to use Compose actions for troubleshooting