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 Platform Community / Forums / Power Automate / Remove domain from use...
Power Automate
Unanswered

Remove domain from user principle name

(0) ShareShare
ReportReport
Posted on by 64

I am trying to build a flow that uses the get user profile (v2) module and only want to pull the user's username from the system. I would like to remove the @xxxxx.com from the user principal name dynamic content and add it to a column in a sharepoint list. How would I do that? 

Categories:
I have the same question (0)
  • David- Profile Picture
    1,254 on at
    Re: Remove domain from user principle name

    You basically want to split the e-mail address into two parts; the address and the domain. You can use the split expression to do this, which will generate an array with two outputs. You can then reference each one of theses through the expression in the compose actions.

    Web capture_20-9-2022_1391_make.powerautomate.com.jpeg

    The expression used in each of the above are:

    1. split(outputs('Get_user_profile_(V2)')?['body/mail'],'@') - splits the e-mail address at the @ symbol
    2. outputs('Compose')[0] - gets the first item from the split (the e-mail address)
    3. outputs('Compose')[1] - gets the second item from the split (the domain)
  • cdmcali Profile Picture
    64 on at
    Re: Remove domain from user principle name

    Here is what happened: Screenshot at Sep 20 10-27-26.png

     

    It put thi sin my sharepoint list: outputs('Compose')[0]

  • cdmcali Profile Picture
    64 on at
    Re: Remove domain from user principle name

    Is this setup right? Screenshot at Sep 20 10-33-43.png

  • cdmcali Profile Picture
    64 on at
    Re: Remove domain from user principle name

    I see what I was doing wrong but still not getting the right result: Screenshot at Sep 20 10-39-07.png

     

    Output: split(flowiitsautomation@XXXXX.edu,'@')[0]

  • cdmcali Profile Picture
    64 on at
    Re: Remove domain from user principle name

    I see what I was doing wrong now. I was not using the expression. Thanks!

  • David- Profile Picture
    1,254 on at
    Re: Remove domain from user principle name

    You need to use the expression builder for the formulas in each of the compose actions. If you have done it correctly, the Inputs will look like the image I posted with a pink box with fx at the beginning. When you click on the input box it should open this menu:

    David_0-1663767026807.png

    You need to click on Expressions and enter the formula in the fx box. As you build it, you can switch to the Dynamic content tab to get the e-mail field, etc. The three expressions you need:

    1. split(outputs('Get_user_profile_(V2)')?['body/mail'],'@') - splits the e-mail address at the @ symbol
    2. outputs('Compose')[0] - gets the first item from the split (the e-mail address)
    3. outputs('Compose')[1] - gets the second item from the split (the domain)

    As long as you did not rename the Get user profile action, and don't rename your first compose action, the bold text above is what should work in the expressions.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard