Auto populate single line field with current user

  • 7 December 2016
  • 9 replies
  • 58 views

Badge +3

Hi

I'd like my Nintex form to have this field auto populated with the current user's Full Name however I can only find 'CurrentUser' which prefix's the username with the domain name. Is there another way to do this without using the people picker? Thanks


9 replies

Userlevel 6
Badge +12

nick Farrington‌ - 

You can easily do this by using a Calculated field on your form and connecting it to the desired field. In your formula, you can use the userProfileLookup function (under Runtime Functions, it is the last one in the list) and go after "PreferredName". It would look like this:

196296_pastedImage_1.png

On the form: 

196292_pastedImage_4.png

If you want to do [First Name] [Last Name], you will need to do it like so:

196293_pastedImage_5.png

On the form:

196295_pastedImage_7.png

I would check out Default user profile properties (SharePoint Server 2010)  to see all of the options you can go after using the userProfileLookup function on the form.

Hope this helps!

*updated one of the screenshots... used the wrong one happy.png

Userlevel 5
Badge +14

if yuo only need to remove domain from what CurrentUser retuns you can use one of string inline functions to do so.

if you do populate controls value through 'Default value' option from configuration dialog, note that it's evaluated just once when form is opened and only when you create new item.

the other option is to populate control's value from javascript.

this is much more flexible but need some experience with javascript.

Badge +3

Hi, I have connected the calculated field to the single field text control and it does not populate it. I can confirm the calculated field is working fine. Could it be because I am using the single text field in a repeating section?

I think even if I get it to work I may a have an issue where the control changes previously entered field values due to me using a repeating section

Badge +3

I can trim the field but I want full name

Userlevel 6
Badge +12

nick Farrington‌ - 

Do you have the "Connected to" control on the form still?

If so you have to either remove the control from the form, or (for some reason this works for me), put the Calculated field at the bottom of the form (or any where after the "Connected to" field).

Also, if you are planning on using CurrentUser, you may want to think about if the controls will update when another user accesses the item later on. Meaning, you may need some rules in place to only use CurrentUser in NewMode only.

Badge +11

Jessie gave you the solution to display the full name. Did that work for you?

Badge +3

Jesse, I have tried this but still no Joy. I do not think this will work in a repeating section...have you tried this using a repeating section? Either way this certain list item will be edited by different users so I think I may have to request the user input their name manually.

With this said the answer is still correct and I have implemented it elsewhere on other forms so thank you.

Userlevel 6
Badge +12

I have not tried this within a repeating section control but I will have to take a look because now I am curious!

Badge +1

Very helpful. I was searching the Internet for a while with no luck until I saw this thread. Thanks!

Reply