How to Auto Populate People Picker in SharePoint 2010
Hello SharePointers,
Let’s say you have a people picker control in a SharePoint List and you want to auto populate with the Current user who is logged into the SharePoint Environment.
You need to add the below piece of code (Jquery) into NewForm.aspx of the SharePoint list where People picker control is present.
<script language=”javascript” type=”text/javascript”>
$(document).ready(function() {
var currentuserName = $().SPServices.SPGetCurrentUser({
fieldName: “RequestorName”
});
$(“textarea[title=’People Picker’]”).val(currentuserName);
$(“div[title=’People Picker’]”).text(currentuserName);
});
</script>
You can read my other article on people picker below
How-to-clear-client-people-picker-in-sharepoint-2013
How-to-set-client-people-picker-value-in-sharepoint-2013
AutoPopulate works like a charm. Happy SharePointing 🙂