cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Andrew260z1
Level: Powered On

Trying to get first part of email address

Hi community,

 

Been struggling with trying to get the first part of a username where <username>@domain.com is the email address;

 

I have a Person field in SharePoint that allows me to use the field Requester Email (works fine when sending the email).

 

Im trying to save the username part of the email address so I can insert a separate internal domain to it so it I was looking to make 2 compose statements that captured the string before the '@' then I can append the other domain to it. So the end result would be username@internal.domain.com 

 

first(split(item()?['Requester']?['Email'],'@'))

 

Been trying a split but it keeps telling me that it is null. Also I'm not sure why the field appears to be split up with a ? between the 2 fields..

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
manuelstgomes
Level 10

Re: Trying to get first part of email address

Hi @Andrew260z1 ,

 

If you're getting null, probably the item()?['Requester']?['Email'] doesn't contain any email (for some reason). Can you check in your flow log if indeed there's an email there? You can do an "if" before to double-check that.

 

If the domain part is always the same, you can also use the following alternative:

 

replace(triggerBody()['text'],'yourdomain','internal.yourdomain')

 

Then you can do it in one "Compose" action.

 

Does this help you?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

View solution in original post

3 REPLIES 3
Highlighted
manuelstgomes
Level 10

Re: Trying to get first part of email address

Hi @Andrew260z1 ,

 

If you're getting null, probably the item()?['Requester']?['Email'] doesn't contain any email (for some reason). Can you check in your flow log if indeed there's an email there? You can do an "if" before to double-check that.

 

If the domain part is always the same, you can also use the following alternative:

 

replace(triggerBody()['text'],'yourdomain','internal.yourdomain')

 

Then you can do it in one "Compose" action.

 

Does this help you?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

View solution in original post

Dual Super User
Dual Super User

Re: Trying to get first part of email address

Hey @Andrew260z1 

 

Can you share a screenshot of the flow? Just want to check from what action you are referencing the value (and basically the attribute that you are referring to from the dynamic selector). 

 

Referencing the wrong attribute in the expression might be a reason this is failing. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Andrew260z1
Level: Powered On

Re: Trying to get first part of email address

You post helped me find a solution, became 4 compose statements in the end. I think the dynamic field cannot return a value since itself is a query. So needed to capture that as a string first then from there do the first and split statement then create another compose with the @internal.domain.com and the 4th one concats both those values together. 

 

If there is a shorter way to achieve this.. let me know.

 

Thanks!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,242)