How to auto select logged in users name/details in Infopath

How can we get the user name of the logged in user on the newform.aspx page and then put it in the drop down list field ?

I applied a rule on the drop down box field but it didn't work.

concat(substring-after(substring-after(userName(), "|"), "|"), "@myCompany.com")

Please help.

March 27th, 2015 2:12pm

Hi-

You could have a text field called 'CurrentUser' with a default value = CurrentUser (under formulas, - user), then have a rule, when that text field is not blank, set a fields value (your drop down) to the value of the text field currentuser.

Free Windows Admin Tool Kit Click here and download it now
March 27th, 2015 2:59pm

Hi-

You could have a text field called 'CurrentUser' with a default value = CurrentUser (under formulas, - user), then have a rule, when that text field is not blank, set a fields value (your drop down) to the value of the text field currentuser.

  • Marked as answer by Prajk11 2 hours 27 minutes ago
March 27th, 2015 6:59pm

Hi-

You could have a text field called 'CurrentUser' with a default value = CurrentUser (under formulas, - user), then have a rule, when that text field is not blank, set a fields value (your drop down) to the value of the text field currentuser.

  • Marked as answer by Prajk11 2 hours 34 minutes ago
Free Windows Admin Tool Kit Click here and download it now
March 27th, 2015 6:59pm

Hi,

It works well. Except that when i set the fields value, the other values in the dropdown goes missing. Only the currentUser value is displayed. 

Is it possible that i can still have the possibility of dropping down and select other values ?

thank you again .

March 28th, 2015 10:08am

HI

http://melick-rajee.blogspot.ae/2012/02/how-to-set-current-user-name-to.html 

Link has the complete article.

In generally we can not set a default value to InfoPath Person/Group Picker. On the other hand we can not get Current Username in the InfoPath. (Yeh it is true that we can use userName() function. But this will return the Current User Account ID not the name).

image

So we want to use SharePoint user profile services to do this.

  • First we need to  create a user profile connection.
    • Thus First go to Manage connection and click add connection.

image

    • Then go to receive data option and SOAP Web service and specify the User Profile Service URL. The URL will be something like (http://sever/sites/site/_vti_bin/UserProfileService.asmx). This is depends on your site or site collection. if it is a site collection you can omit /sites/site/ part from your URL.

image

then proceed to next , select UserProfileByName and un select the Automatically load.Now you have created the connection.

image

  • Now you have User Profile connection to receive profile data.

image

  • For an example we will design a form like below. You need to set the current user automatically when the form load.

image

  • Then Go to the Form Load Rules.

Free Windows Admin Tool Kit Click here and download it now
March 28th, 2015 11:52pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics