I have an infopath form loaded as an initiation/association form for a sharepoint workflow. I added a text field wich I want to be prefilled with the current user username. I'm using username() to get this. The problem is that it works great when I preview it in infopath, but once I deploy it to sharepoint the field is always empty.

I tried both setting username() as a default value for the field and with a rules on form load that sets the field value to username(). Neither works.

If I replace username() with any string (like "ciao"). the value is correctly set.

Any idea on how to get this working?

  • What kind of authentication is your sharepoint farm using ?
    – Steve B
    Commented Jun 21, 2012 at 12:54
  • basic windows authentication Commented Jun 21, 2012 at 13:23
  • I had a similar issue, but i had issues with the function being case sensitive - userName()
    – Brent
    Commented Jun 28, 2012 at 3:54

1 Answer 1


I experienced the same problem and added additional idle call to username(); before assigning a value and it started to work (I used the call twice). If I deleted the idle call, the next username returned the null value. When I added it again, it worked fine. I didn't find a root of the problem, but now it works well with the idle call.

  • Was it in browser but not filler/client for, I wonder? Have you tried to enable always in Text box properties > Browser Forms (tab) > Postback Settings? Commented Aug 24, 2012 at 14:49

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.