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

User().Email with split

Hi All,

I have been trying to create a user form. I have a Field Named CREATED_BY different from default ("CREATED BY") . I aware That "CREATED BY" will give the Author Name but i need only the UserID for my CREATED_BY field. I tried applying User().Email function in default property of my CREATED_BY and i found that Email contains the Userid + company domain eg(AABBCCDD@XYZ.COM)

I want AABBCCDD as value for my CREATED_BY field.  CREATED_BY field will be not visible to the user in the user form which i designed it . so the value should be default and reflected in sharepoint list.

 

Sharepoint listSharepoint listCREATED_BY fieldCREATED_BY field 

1 ACCEPTED SOLUTION

Accepted Solutions

@rohitsekar1996 , Use below formula to get the UserID from User().Email:

 

First(Split(User().Email, "@")).Result

 

  • Use above formula in Default property of text input
  • Set DisplayMode property to DisplayMode.View : It will not allow users to edit the value
  • If you want to hide it from users then set Visible property to false

Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it 👍.

View solution in original post

5 REPLIES 5
Super User III
Super User III

@rohitsekar1996 


You could obtain the Username like this.

 

First(Split("yourname@yourcompany.com", "@")).Result  // will return "yourname"

 

Therefore this would work too:

 

First(Split(User().Email, "@")).Result

 

---

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Thanks for the Reply, How to make this value a Default Value so User Cant change this Value in Userform.

Set the field to the read version in form fields or unlock the card and make the displaymode to view. Then set the update property to the above formula given.  Also you can update the default property to same formula as well.  

@rohitsekar1996 , Use below formula to get the UserID from User().Email:

 

First(Split(User().Email, "@")).Result

 

  • Use above formula in Default property of text input
  • Set DisplayMode property to DisplayMode.View : It will not allow users to edit the value
  • If you want to hide it from users then set Visible property to false

Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it 👍.

View solution in original post

Frequent Visitor

I found an issue whereby the User().Email may not return a value which matches the User ID value you might expect. This is particularly true for users with multiple registered SMTP values (these can be seen using Outlook client's Address Book search and then viewing the "E-mail Addresses" tab of the contact card). This is a big gotcha for our company because we have quite a few users with multiple registered SMTP values, many of which have local-parts (the part before the '@') which do not match their user principal name. My account is one of those. To get around this possibility for mismatch, I turned to the true user identifier (a GUID). To get that, I used the Microsoft365Users connector with the following formula: 

 

Microsoft365Users.MyProfileV2({'$select':"id"}).id

 

This returns the UserId of the current user (a GUID as text).

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,010)