Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

This is for SP2010. Got a list. One of the fields is a "Person or Group" type, with the results limited to members of an SP group.

I've created a copy of NewForm.aspx in SharePoint Designer, and am trying to figure out how to set that field, which displays using the People Picker, so that on page load, the current user is loaded as the default value.

Fwiw, I've added SPServices to my NewForm.aspx, so it's available as a possible solution to the problem. I'm just not familiar with working with that People Picker control, so I'm hoping somebody has a fairly painless answer.

share|improve this question

5 Answers 5

up vote 2 down vote accepted

If you want to use SPServices, I added a new function called SPFindPeoplePicker to v0.7.2 (released on 24 Sep 2012) which will let you set the People Picker value easily.

share|improve this answer

Another option is to use JavaScript to inject the current user, for example by using jQuery like this:

var ctx = new SP.ClientContext();
var user = ctx.get_web().get_currentUser();
ctx.executeQueryAsync(function() {
  $('.ms-formbody').filter(function() {
    return $(this).html().match(/spfielduser/i);
  }).each(function() {
share|improve this answer
I'm trying this, got it inside a $(document).ready block, but am getting a JS err about SP.ClientContext() not existing. Googling "SP.ClientContext" leads me to believe it's a built-in SharePoint js func that should be available. Is it, or do I need to include a script src to it? – Alan M Sep 25 '12 at 19:01
Yes it should be there, it's part of the [](JavaScript SP namespace). If you are using Chrome then adding jQuery document ready can sometimes break the loading of body, in that case try manually running _spBodyOnLoadWrapper() in your console. – eirikb Sep 25 '12 at 19:33
I'm using IE7 (yes, I know, I know. Corporate environment, out of my control). I'm going to see what's up with SP.ClientContext not working, but I can see from that docs and your example that it should be the tool for the job. – Alan M Sep 25 '12 at 19:37

View this add-on(SharePoint Default Value Add-On), which inject a "default value" section into "Create Column" dialog.

Set "Current User" (User who is adding item) as default value.

enter image description here

share|improve this answer
SPUser user = web.CurrentUser;
PickerEntity entity = new PickerEntity();
entity.Key = user.LoginName;
System.Collections.ArrayList entityArrayList = new System.Collections.ArrayList();

That should populate the people picker instance with the current user.

share|improve this answer
Is this Javascript? – Batman Aug 16 '13 at 0:04
No, it's C#. eirikb's answer is Javascript. – RJ Cuthbertson Aug 16 '13 at 3:31
function fnassign(){
       var len3=$("div [title='Assign To']").find(".sp-peoplepicker-resolveList").find("span").length;
          alert("Please enter the AssignTo value");
          return false;

Click here more details

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.