I am trying to make a field in a list autopopulate with the signed in user. I tried the Lookup field and it gives me a choice but it doesn't change based on which user is logged in. Any ideas how I get that to work? For instance:

Initiated by: (should autopopulate currently logged in user)


1 Answer 1


In SharePoint 2013 you can do this by adding a JavaScript to the New form.

<script type="text/javascript">

var loginName = "";
var userid = _spPageContextInfo.userId;


function GetCurrentUser() {

var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")";    
var requestHeaders = { "accept" : "application/json;odata=verbose" };

  url : requestUri,
  contentType : "application/json;odata=verbose",
  headers : requestHeaders,
  success : onSuccess,
  error : onError

function onSuccess(data, request) {
    var loginName = data.d.Title;
    //set the value to the field "LogedInUser" in the new form

function onError(error) {


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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