web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Filter empty BusinessPhones and change BusinessPhones to string

(0) ShareShare
ReportReport
Posted on by 6
Hello,
 
I am trying to get the business phones from Office 365 and return a list on SharePoint. 
 
I would like to filter out those users without business phone.
 
Example of the output of 'Search for users (V2)' (no BusinessPhones):
{
                "Id": "123",
                "AccountEnabled": true,
                "BusinessPhones": [],
                "Department": "abc",
                "DisplayName": "abc",
                "Mail": "abc@mail.com",
                "MailNickname": "abc",
                "UserPrincipalName": "abc@mail.com"

}
 
I tried different methods including the action 'Condition' and 'Filter Array' with the expressions but failed:
e.g. 
@not(empty(outputs('search_for_users_(V2)')?['body/businessPhones']))
@not(equals(outputs('search_for_users_(V2)')?['body/businessPhones'], null))
@not(equals(empty(outputs('search_for_users_(V2)')?['body/businessPhones']),true))
@not(equals(outputs('search_for_users_(V2)')?['body/businessPhones'])?[0], null))
 
Moreover, I would also like to display the business phones in string instead of array.
Current display in SharePoint List: ["1234 5678"] (same as the output of 'get user profile')
Idel display: 1234 5678
 
How can I solve the above problems? Many thanks.
 
I have the same question (0)
  • Verified answer
    Jalpa Mahesh Dhola Profile Picture
    35 on at
    Filter empty BusinessPhones and change BusinessPhones to string
    1. You need to change the condition as 
         
           Apply to each 
           
          outputs('search_for_users_(V2)')?['body/value']

          after that, add the condition action with expression
     
        not(empty(item()?['BusinessPhones']))
     
    2. And to get a string from BusinessPhones array, you will have to iterate the BusinessPhones array and append to one string variable and then directly add that variable to SharePoint list field

  • Suggested answer
    HC-08110621-0 Profile Picture
    6 on at
    Filter empty BusinessPhones and change BusinessPhones to string
    Thanks @alpa Mahesh Dhola . It probably because I did not put a loop before I use the empty function.
     
    Here's how I solve the problem finally. I put the actions after 'get user profile' instead of 'search for user (V2)'.
     
    1. Change BusinessPhones to string
    Add a ’Compose' action to return the first item in the BusinessPhones array.
    2. Filter empty BusinessPhones
    After 'Compose', add conditions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 655 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 371 Moderator

#3
chiaraalina Profile Picture

chiaraalina 276

Last 30 days Overall leaderboard