cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cjwilson80
Helper I
Helper I

Power Automate Action to Extract First Name from Parenthesis in User Display Name

I have a Power Automate Flow that sends reminder emails to users when a deadline is approaching. Right now, the name in the email body appears as "Wilson, C (Courtney)". How can I parse this out so that I can extract the first name and last name from the display name? I am running this flow on a recurrence, that runs every day and gets all items in a list that match certain criteria.

See screen shots attached. Thank you!

 

EmailExample.png

EmailExample2.png

  

EmailExample3.png

1 ACCEPTED SOLUTION

Accepted Solutions

@cjwilson80 You can use same logical expression only few tweaks-

To get first name-Use

First(Split(Last(Split(outputs('Compose'),'(')),')')) 

explanation- Here i am splitting display name by using separator '(' and then picking up everything till last using last(). After that again i am splitting remaining text by using separator ')' and then picking up complete text.

 

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

View solution in original post

12 REPLIES 12
Hardesh15
Super User
Super User

@cjwilson80  Use split() function.  

First Name- Last(split("Wilson, C (Courtney)"),', ')

Last Name- First(split("Wilson, C (Courtney)"),',')

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

@Hardesh15  Do I put this in a compose action, or a set variable? 

@cjwilson80  Pls use compose action.

Hardesh15_0-1656572201478.png

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

 

It doesn't matter.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

@VictorIvanidze  Pls avoid such comment.

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

VictorIvanidze
Community Champion
Community Champion

@Hardesh15, why? Do you believe that using the Compose action is better than using the "Set variable"?

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

@VictorIvanidze Please avoid such discussion. Pls give complete solution if possible. Also if someone is already responding to thread do not come in between. There are others unanswered threads where your input could help someone.

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

 

@Hardesh15  THANK YOU SO MUCH!!! This works, however.... now it displays the first name as C (Courtney).  How do I remove the C () and just get Courtney?

 

cjwilson80_1-1656599952830.png

 

@cjwilson80  is this applicable to all names? Or only few users have such naming style.

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

@Hardesh15  This applies to ALL names in the 'Get Items' action I'm using to pull back Condition Owners from a SharePoint list. So, every user name has a Display Name that is formatted as LastName, First Initial (First Name)

@cjwilson80 You can use same logical expression only few tweaks-

To get first name-Use

First(Split(Last(Split(outputs('Compose'),'(')),')')) 

explanation- Here i am splitting display name by using separator '(' and then picking up everything till last using last(). After that again i am splitting remaining text by using separator ')' and then picking up complete text.

 

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

@Hardesh15  THANK YOU!!! This did the trick, works perfectly!!! Have a wonderful day 🙂 

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,777)