1

I am designing a form that basically has two people picker fields.

One is the currently logged in user, and the other is the manager.

What I would like, is that whenever the form is opened, the default value is set to the currently logged in user and the manager, in the respective fields.

Everything works fine in InfoPath when I preview the form, and it loads the user + manager, however, when I upload it to Sharepoint and try to open the form, the error message is as follows:

An error occurred while trying to connect to a Web service.

An entry has been added to the Windows event log of the server.
Log ID:5566

Correlation ID:8890c152-fc77-435a-86b8-f18ce5458adb

Only the currently logged in user is shown, but the manager field is blank.

I have setup the fields as follows:

Created a Form Load in Infopath with two actions

Action one: Set Requestor (currently logged in user)

Condition: none - run when form is opened

Rule type: action, and run these actions:

Set DisplayName = Value[Name="PreferredName"]
Set AccountID = Value[Name="AccountName"]
Set AccountType = User

The Manager field is set similarly:

Set DisplayName = Value[Name="Manager"]
Set AccountID = Value[Name="Manager"]
Set AccountType = User

Oddly when I set the Data Connection for GetUserProfilyByName and set it to not automatically retrieve information every time the form is opened, the error does not show up in Sharepoint, however, neither does the field ...

Does anyone know what the problem is?

Any help greatly appreciated!

Source: http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-2D00-Get-the-current-user-without-writing-code.aspx

0

In case anyone else tried to do it this way:

  • Why to bother with code to do this?

I usually do this by creating a SOAP data connection in InfoPath UI and hook it to User Profile service and query info from there (e.g. Manager or any other profile-related attribute)...

just Google : "get manager from user infopath soap" and you will get many blog articles with screenshots and easy-to-follow steps. I did it for SharePoint Online (which would seem harder!) and it worked like charm.

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.