In my D8 site i have several webforms created. I would like to have a Webform element that will pull/prepopulate logged in user's username. Is there a way to achieve that from GUI?

The reason i want that element is that from within Webform Submissions i would like to be able to filter per Username of the user who submitted the webform. This way username will be included in submission data.

By default it allows filtering webform submissions per submission data only or administrative notes.


1 Answer 1


You can create a Value element with a token to capture and store the current user's name.

 '#title': 'User Name'
 '#type': value
 '#value': '[current-user:name]'

enter image description here

  • Thanks @jrockowitz. I will add Token module and give it a try
    – hzak
    Commented Jan 7, 2019 at 22:37
  • It worked perfectly, i did not even have to add token module. Core tokens pulled in the User Name.
    – hzak
    Commented Jan 7, 2019 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.