Forum Discussion
Cleaning Up UserName() Function using Infopath
Is there a reason you want just part of an email and not their actual name? There is a great post on how to retrieve various user information: https://www.qdoscc.com/blog/how-automatically-retrieve-current-username-infopath-sharepoint-list-form
If you don't mind "helper" fields that you hide on the form you can always have two fields. One named "emailAddress" that says: substring-after(userName(), "i:0#.f|membership|")
And the second could be the field you want by putting in: substring-before(emailAddress, "@abc.com")
You would end up with an extra field that you could hide, but it should get you the end result that you are looking for. You could also use the post listed above and choose WorkEmail instead of PreferredName and put in in this formula instead of emailAddress: substring-before(<follow post directions here>, "@abc.com")
Tim