Forum Discussion
Auto populate person field with current user - InfoPath
Were you ever able to figure this out? I'm in the same boat right now...
I'm afraid I have not. In fact, I just had to deal with this again, yesterday.
Fresh eyes did not help.
I'm using SPO, and it's the same regardless of which of four browsers I use. (And I find it philosophically offensive to prompt the user to select their own name, instead of being able to default to it.)
- Tamras1972Mar 08, 2019Iron Contributor
It's been awhile and we're no longer using InfoPath so I hope my recollection below is correct. In form load, add a rule that if ID is blank (i.e. new form), set a text field (i.e. CurrentUser) value to equal UserName(). Then set the people picker (AccountID) value to this field (CurrentUser). If I remember correctly, I had to use substring to remove any part of UserName() result to just give me the email address before I could use it as the value for the people picker. Hopefully this helps. If I find a copy of the old xml file, I'll try to post the exact solution.
- BenSteginkMar 08, 2019Steel Contributor
Yup, same here. It's weird...all the fields get set. I can even configure it all like that. Load the form, go into the people picker type a [space] and change focus and suddenly the user shows up in the people picker. It's like it loads all the data properly but never does that last callback/refresh to do the final load of the person into the people picker. It takes a manually change within the form for the person to be populated.
- Michael BoonieMar 08, 2019Copper Contributor
Yes, that's how I USED to do it, but that's the issue: it does not work anymore.
I tried using both an un-trimmed username() value (e.g. i:0#.f|membership|mboonie@myemailaddress.com) and my plain email, but neither of them caused the people picker to update. Using my old developers' trick of placing calculated controls on the form to display all "hidden" values, I see that the Form Load rules set AccountID, but the DisplayName and the AccountType are still empty (even if I click the Check Name button.)
Again, I'm in Windows 10 using SPO, and this is a browser-enabled, "Form Library form", as opposed to a List form; but this function no longer works in any situation for me.