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
    Jun 21 '12 at 12:54
  • basic windows authentication Jun 21 '12 at 13:23
  • I had a similar issue, but i had issues with the function being case sensitive - userName()
    – Brent
    Jun 28 '12 at 3:54

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? Aug 24 '12 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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