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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Substring of Email Id

(0) ShareShare
ReportReport
Posted on by 390

Hey Team,

I have an email id of an employee and while creating the UserId of that employee, I want the prefix of the email i.e. the part before @ in the email.

Eg: if email is Alex.Martin2@xyz.com then I want the userId = Alex.Martin2. So how can we do this, like we have split function in PowerApp, is there any function here we can use to get the above result? 

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Hi skd,

    x++ has plenty of string functions, you can find them here: docs.microsoft.com/.../xpp-string-run-time-functions

    You have many options to use these functions to achieve the goal.

    One is here:

    1) Use strFind to find the position of @ character.

    2) Then use subStr to read part of the string, from beginning until the position that you found with strFind.

  • Verified answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    str name = "Alex.Martin2@xyz.com";
        
    name = subStr(name,1,strFind(name,"@",1,strLen(name))-1);

  • skd Profile Picture
    390 on at

    Hey Nikolaos Mäenpää,

    Thank you this helped me.

    I had another question if in the above example I want it this way:

    str email = Alex.Martin2@xyz.com;
    Name = Alex Martin2

    How can I achieve this. I want to use the given email id to form the username. Remove the "." and add space between the first name and last name. Which methods can I use to achieve this? Pls help me.

  • skd Profile Picture
    390 on at

    Hey Ergun Sahin,

    Thank you, this helped me. Please can you help me with the username query as well?

  • Verified answer
    Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at

    You already know how to get Alex.Martin2. Then use strReplace() to replace dots with spaces.

  • skd Profile Picture
    390 on at

    Okay, Thank you.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans