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

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
Super User II
Super User II

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
Super User II
Super User II

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

Highlighted
Dual Super User III
Dual Super User III

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!

Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Users online (7,166)