0
votes

I'm having a problem with the Person Picker control in InfoPath 2010. I enter a name and it is resolved and displayed on the control. So far, so good. Now I'm trying to retrieve the value of AccountId provided by the control. It works when I preview the form locally but when I publish it to SharePoint (this is a browser-enabled form) the AccountId is coming back as blank.

Below is the XPath I'm using. (I tried adding an index, as in "Person[1]", but InfoPath didn't like that either. Besides, I've limited the control so that only 1 user can be entered.)

/my:myFields/my:ApproverGroup/my:Analyst/pc:Person/pc:AccountId

Same result if I try to get DisplayName or AccountType--works in preview but not when I publish. And I'm publishing to my local SharePoint Server (same machine I'm developing on).

Any ideas? Thanks in advance.

1

1 Answers

0
votes

I figured it out. Turns out a postback is required before the data source will reflect the value entered in the People Picker control. Why this is I don't know, but it somehow primes the control to work properly. This postback can be done once on form load and then the People Picker will work after that. So my next problem was looking for a way to force a postback on form load. Also, the People Picker inexplicably does not include a "Postback settings" property as, say, a textbox does. I resorted to enabling the postback setting to "Always" on the first textbox on my form, hoping the user will enter a value there before scrolling down to the People Picker control. It's a terrible hack, but the only workaround I have so far. If anyone can provide a better answer here please do so.