cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Get telephoneNumber attribute from User Profile

I have a Flow which currently has the steps of SharePoint - On New Item Created -> Get User Profile (V2) -> Send an email (email contains values from both the SharePoint list item and the User Profile).

 

One thing that is missing is the telephoneNumber attribute. This would translate to the Phone number on the primary contact card in Outlook (or again, telephoneNumber attribute in Active Directory). How can I extract this? I see there is a Business Phones but I need to get that singular attribute, not an array of values... If Business Phones were my only option, how can I get that singular value as I do see it places my Send Email action into a foreach action.

 

The last thing I need to do is make sure that if the value of that phone number is not populated that the Flow does not fail and simply sends a blank value in the Send an email action. I'm not sure if it does this by default.

2 REPLIES 2

HI @trevorseward,

 

The following flow did it for me:

 

GetPhone.PNG

 

The business phone number in the email you can get with the following expression:

 

body('Get_user_profile_(V2)')?['businessPhones']
 
The Apply to each is a bit annoying, but doesn';t result in multiple emails as long as there is just one telephone number.
 
To make sure that an email is still sent when there is no number set you might want to set a varibale with the telephone number in the apply to each and then after the apply to each send the email as shown above.
 
Then finally you can use the coalesce function to avoid failures of unset fields. coalesce(X,'whatever') returned 'whatever' when X is not set otherwise it will return X. 
 
 

 

Hi @Pieter_Veenstra 

I cannot build it as you did in the screenshot. Whenever I try I got something like this in the "Apply to each" step:

Michal_0-1599772424270.png

 

And thank you for the tip with the coalesce... 

I have used it like this (might be helpful): 

coalesce(first(item()?['BusinessPhones']),'')
 
 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (2,381)