Jan 12 2017 08:56 AM
Jan 12 2017 08:56 AM
I've seen this done, so I know it's possible, but I just wasted an hour searching on the internet, hoping to figure out how to do it. I want the current user to be automatically added to the People field in my InfoPath form, so users don't have to look themselves up. This should be simple, but of course it's not... there should be a setting in the People or Group field in SharePoint to automatically populate the field with the current user. Similar to how I'm able to set the default for a date field to "Today." All I can find on the internet is overly complicated (and outdated) methods to do this, and none of them are usable for me. Please tell me there's a simple way to do this!
Mar 14 2017 09:07 AM - edited Mar 14 2017 02:21 PM
@Pieter Veenstra, I am using SharePoint Online/Office 365 - is there another way to accomplish this? I was told we have E3 license but I was not able to access the path. I have admin rights.
Are there any settings, on SP, I need to enable to access it? Thanks.
Edit: Nevermind. I got it to work by using UserName() as the default value of the people picker (AccountID).
May 09 2018 11:47 AM
Hi. How did you get the 'UserName()' function to stet the value of people picker field? I tried doing this and it simply won't set.
Nov 20 2018 09:23 AM
I have the same issue: In fact, I can manually set the all three values of the repeating 'pcPerson' group (DisplayName, AccountID, and AccountType) and a repeating table bound to the repeating 'pcPerson' group shows the values that I set (which, after testing, I verified as equal to values I'd get if I actually used the People Picker control); yet the actual People Picker control stays blank!
I did extensive testing to tell it's not quite "set," but it's still very confusing. Because one can't set a rule on a People Picker control, I used the time-honored trick of binding a text field ('strRequestorID') to the AccountID of the picker and setting a rule on THAT field. The rule--which apparently is being triggered--uses one of the values (DisplayName) from the Picker control to set a different value elsewhere; but the value being retrieved is blank, which is mighty confusing in itself, because the rules is only supposed to run when it's NOT blank!
At this point, I'd even welcome a workaround, although I'd really like to know what's going on.
Mar 08 2019 06:15 AM
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.)
Mar 08 2019 11:07 AM - edited Mar 08 2019 11:09 AM
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.
Mar 08 2019 12:50 PM
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:firstname.lastname@example.org) 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.
Mar 08 2019 01:38 PM
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.