none
Autopopulate a SharePoint People field with current logged in user Logon name. RRS feed

  • Question

  • Hi,

    I have a SharePoint Survey List and currently the "Created By" Field shows user display name. Instead, what I want to do is..

    create a question in survey that uses people field data type and have it set to logon name of the  "created by" field and make the question read-only. 

    Please offer any suggestions on how to solve this problem,


    techie

    Friday, May 1, 2015 3:56 AM

Answers

  • Hi

    create your own column(type as people or group).

    1.Go to list setting.in my case it was ("https://tmc.atrackspace.com/my/_layouts/15/start.aspx#/_layouts/15/survedit.aspx?List={A85BE008-7666-4943-9420-9B554F184C07}")

    2. twik the url as (https://tmc.atrackspace.com/my/_layouts/15/fldNew.aspx?List=%7BA85BE008-7666-4943-9420-9B554F184C07%7D) and create column (type as people or group) by providing name and click on finish

    http://www.sharepoint-journey.com/create-columns-in-survey-list.html

    3.edit page in designer and the JavaScript to populate the peoplepicker. so this will be your add on column to maintain the user response.

    then go with javascript/jquery to do so.


    Rajendra Singh
    Walking on water and developing software from a specification are easy if both are frozen
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful




    Saturday, May 2, 2015 4:03 AM
  • Hi,

    You cannot edit the Survey List' forms like usual custom list. But you can open the Survey's NewForm.aspx in SPD but you cannot place the people picker in the form too.

    Alternatively, you can place the html or asp.net text box and pre-populate with the currently logged in user using SPService.

    Just for informational purpose only, you cannot save this text field into survey list because,already SharePoint mange the user response for each of question in Survey.



    Murugesa Pandian| MCPD | MCTS |SharePoint 2010


    Saturday, May 2, 2015 4:56 AM

All replies

  • hi

    you need to use JavaScript code for the same.

    <script src="/my/Style%20Library/jquery-1.11.2.js"></script><script language="javascript" src="/my/Style%20Library/jquery.SPServices-0.6.2.js" type="text/javascript"></script><script language="javascript" type="text/javascript"> </script> ​​​​ 
    <script language="javascript" type="text/javascript">
    $(document).ready(function() {
    var userName= $().SPServices.SPGetCurrentUser();
    $(".sp-peoplepicker-initialHelpText.ms-helperText").text("");
    $(".sp-peoplepicker-topLevel").val(userName);
     $(".sp-peoplepicker-topLevel").text(userName);
     });
    </script>


    Rajendra Singh
    Walking on water and developing software from a specification are easy if both are frozen
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful





    Friday, May 1, 2015 4:07 AM
  • Please note I am using a Survey List and people field does not allow setting a default value in sharePoint 2013.

    techie

    Friday, May 1, 2015 9:14 PM
  • Hi

    create your own column(type as people or group).

    1.Go to list setting.in my case it was ("https://tmc.atrackspace.com/my/_layouts/15/start.aspx#/_layouts/15/survedit.aspx?List={A85BE008-7666-4943-9420-9B554F184C07}")

    2. twik the url as (https://tmc.atrackspace.com/my/_layouts/15/fldNew.aspx?List=%7BA85BE008-7666-4943-9420-9B554F184C07%7D) and create column (type as people or group) by providing name and click on finish

    http://www.sharepoint-journey.com/create-columns-in-survey-list.html

    3.edit page in designer and the JavaScript to populate the peoplepicker. so this will be your add on column to maintain the user response.

    then go with javascript/jquery to do so.


    Rajendra Singh
    Walking on water and developing software from a specification are easy if both are frozen
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful




    Saturday, May 2, 2015 4:03 AM
  • Hi,

    You cannot edit the Survey List' forms like usual custom list. But you can open the Survey's NewForm.aspx in SPD but you cannot place the people picker in the form too.

    Alternatively, you can place the html or asp.net text box and pre-populate with the currently logged in user using SPService.

    Just for informational purpose only, you cannot save this text field into survey list because,already SharePoint mange the user response for each of question in Survey.



    Murugesa Pandian| MCPD | MCTS |SharePoint 2010


    Saturday, May 2, 2015 4:56 AM