Hi,
I am trying to filter out users with a specific phone number from Office Search for users (V2)
First wanted to filter the array using nested ['BusinessPhones'] array but it didn't work.
I have used this but apparently I am mismatching string with the array. Does anyone have any idea how this could work?
In the filter I used:
@contains(first(item()?['BusinessPhones']), '+45')
When the above has failed I tried another approach and tried to apply the filter within "Apply to each" of the found users.
I have used this in the condition:
@contains(first(item()), +45)
But got this error. Again I am mismatching types.
Can you give me a hint how to get it to work?
Solved! Go to Solution.
Unfortunately, it didn't work as you suggested, but it pointed me in a good direction.
If searching for a specific phone number, the working condition looks like this:
Where Business phones is equal to array('+45#########')
In advance mode it looks like this:
@equals(items('Apply_to_each')?['BusinessPhones'], array('+45#######'))
If searching for a fragment of the phone (i.e. by country code), this works almost as you suggested. There are some details different:
On the left side: string(item())
On the right side: string('+45')
In advance mode it looks like this:
@contains(string(item()), string('+45'))
Thank you for help!
I'd like to go back to my original solution, as it's working in my tests and I believe it could work for you as well. I see from your screenshots that you doing an Apply to Each over the Value collection. I don't think it's necessary to do this loop. We should be able to set that value collection as the "From" in your filter, and still have it search only the Business phones array.
What I would suggest is to create a new Filter Array, and don't put it inside a loop this time. Set the From field to "value" from your "Search for Users" action, and then go to advanced mode and set the criteria to this:
@contains(string(item()?['BusinessPhones']), string('+45'))
If it doesn't work, let me know what happens. Do you get error messages, or does it just not return the results that you expect it to?
You're getting confusing results because contains() behaves differently if it's applied to an array or a string.
If you run contains() on a string, it looks for a substring.
If you run it on an array, it looks for an array element that matches the full value. (not a substring)
So you have two options for how to solve this. If you have the full number that you're looking for, the easiest way would be like this:
If you don't have the full number, and want to filter out any number that contains '+45', it's a little trickier. You will need to convert both sides of your filter criteria into strings:
The expression for the left string() is this:
string(item()?['BusinessPhones'])
The expression for the right side is this:
string('+45')
Unfortunately, it didn't work as you suggested, but it pointed me in a good direction.
If searching for a specific phone number, the working condition looks like this:
Where Business phones is equal to array('+45#########')
In advance mode it looks like this:
@equals(items('Apply_to_each')?['BusinessPhones'], array('+45#######'))
If searching for a fragment of the phone (i.e. by country code), this works almost as you suggested. There are some details different:
On the left side: string(item())
On the right side: string('+45')
In advance mode it looks like this:
@contains(string(item()), string('+45'))
Thank you for help!
Glad you found something that's working for you! However, the solutions you are using might have a few unintended side effects.
Your first solution:
@equals(items('Apply_to_each')?['BusinessPhones'], array('+45#######'))
This will work fine as long as the individual only has one Business phone number. If they have two or more business phone numbers on record, it will not return them in your results, even if one of the numbers matches your filter.
Your second solution:
@contains(string(item()), string('+45'))
This searches the entire object for '+45', not just the phone numbers. So if by some strange coincidence someone had '+45' as part of their email address or job title or department or anything like that, they would be included in the results of your filter. This is pretty unlikely, though.
If these side effects won't be an issue with your dataset, great! If you want to keep troubleshooting, I can help you take a closer look at what's going on.
You are right. So how to address those two scenarios?
When trying to build the condition on arrays and I use "contains" a specific array with the specific phone, it doesn't catch the phone.
@contains(items('Apply_to_each')?['BusinessPhones'], array('+45########'))
What do I do wrong?
I'd like to go back to my original solution, as it's working in my tests and I believe it could work for you as well. I see from your screenshots that you doing an Apply to Each over the Value collection. I don't think it's necessary to do this loop. We should be able to set that value collection as the "From" in your filter, and still have it search only the Business phones array.
What I would suggest is to create a new Filter Array, and don't put it inside a loop this time. Set the From field to "value" from your "Search for Users" action, and then go to advanced mode and set the criteria to this:
@contains(string(item()?['BusinessPhones']), string('+45'))
If it doesn't work, let me know what happens. Do you get error messages, or does it just not return the results that you expect it to?
It works OK.
But I found another obstacle. The Search for users (V2) returns only 1000 records. I got more than that and this is why I don't get a result as the phone I am looking for is out of those first 1k records.
Any idea how to overcome this?
Maybe this method would work for you?
I don't have that many users in my environment so I can't test it.
It worked OK. Thank you.
The maximum amount of records which can be retrieved is 5k by changing the pagination:
Episode Seven of Power Platform Connections sees David Warner and Hugo Bernier talk to Dian Taylor, alongside the latest news, product reviews, and community blogs. Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show.
Super Users – 2023 Season 1 We are excited to kick off the Power Users Super User Program for 2023 - Season 1. The Power Platform Super Users have done an amazing job in keeping the Power Platform communities helpful, accurate and responsive. We would like to send these amazing folks a big THANK YOU for their efforts. Super User Season 1 | Contributions July 1, 2022 – December 31, 2022 Super User Season 2 | Contributions January 1, 2023 – June 30, 2023 Curious what a Super User is? Super Users are especially active community members who are eager to help others with their community questions. There are 2 Super User seasons in a year, and we monitor the community for new potential Super Users at the end of each season. Super Users are recognized in the community with both a rank name and icon next to their username, and a seasonal badge on their profile. Power Apps Power Automate Power Virtual Agents Power Pages Pstork1* Pstork1* Pstork1* OliverRodrigues BCBuizer Expiscornovus* Expiscornovus* ragavanrajan AhmedSalih grantjenkins renatoromao Mira_Ghaly* Mira_Ghaly* Sundeep_Malik* Sundeep_Malik* SudeepGhatakNZ* SudeepGhatakNZ* StretchFredrik* StretchFredrik* 365-Assist* 365-Assist* cha_cha ekarim2020 timl Hardesh15 iAm_ManCat annajhaveri SebS Rhiassuring LaurensM abm TheRobRush Ankesh_49 WiZey lbendlin Nogueira1306 Kaif_Siddique victorcp RobElliott dpoggemann srduval SBax CFernandes Roverandom schwibach Akser CraigStewart PowerRanger MichaelAnnis subsguts David_MA EricRegnier edgonzales zmansuri GeorgiosG ChrisPiasecki ryule AmDev fchopo phipps0218 tom_riha theapurva takolota Akash17 momlo BCLS776 Shuvam-rpa rampprakash ScottShearer Rusk ChristianAbata cchannon Koen5 a33ik Heartholme AaronKnox okeks Matren David_MA Alex_10 Jeff_Thorpe poweractivate Ramole DianaBirkelbach DavidZoon AJ_Z PriyankaGeethik BrianS StalinPonnusamy HamidBee CNT Anonymous_Hippo Anchov KeithAtherton alaabitar Tolu_Victor KRider sperry1625 IPC_ahaas zuurg rubin_boer cwebb365 Dorrinda G1124 Gabibalaban Manan-Malhotra jcfDaniel WarrenBelz Waegemma drrickryp GuidoPreite If an * is at the end of a user's name this means they are a Multi Super User, in more than one community. Please note this is not the final list, as we are pending a few acceptances. Once they are received the list will be updated.
Join us for an in-depth look into the latest updates across Microsoft Dynamics 365 and Microsoft Power Platform that are helping businesses overcome their biggest challenges today. Find out about new features, capabilities, and best practices for connecting data to deliver exceptional customer experiences, collaborating, and creating using AI-powered capabilities, driving productivity with automation—and building towards future growth with today’s leading technology. Microsoft leaders and experts will guide you through the full 2023 release wave 1 and how these advancements will help you: Expand visibility, reduce time, and enhance creativity in your departments and teams with unified, AI-powered capabilities.Empower your employees to focus on revenue-generating tasks while automating repetitive tasks.Connect people, data, and processes across your organization with modern collaboration tools.Innovate without limits using the latest in low-code development, including new GPT-powered capabilities. Click Here to Register Today!
We are excited to share the ‘Power Platform Communities Front Door’ experience with you! Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well. Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities. Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform. Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.
We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida. Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more. Register today: https://www.powerplatformconf.com/
User | Count |
---|---|
94 | |
34 | |
28 | |
24 | |
22 |
User | Count |
---|---|
131 | |
57 | |
42 | |
41 | |
41 |