none
sharepoint 2010 calender list new form auto populate Name and Department

    Question

  • We have a SharePoint 2010 Calendar list to book a conference room, we are trying to auto populate the Name and Department in the calendar new form.

    We have tried using javascript for Name but that's only working for administrator not for users. Please advice for the same.

    Wednesday, November 13, 2013 5:15 AM

Answers

  • Hi Manikandan,

    In Calendar list against the user name coulmn you canset the default value as [Me] which will automatically populate the logged in user.This will work only for "People or Group" column.

    Regards,


    Sairam Avacorp Technologies

    Wednesday, November 13, 2013 6:30 AM

All replies

  • Hello,

    Could you share that script with us? Also make sure that you are giving absolute URL of script ref if any and that script file is approved and user is having read access on that script file.


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Wednesday, November 13, 2013 5:53 AM
    Moderator
  • Hi Hemendra,

    Please find the Javascript below.  Also all user having a contribute permissions.

    <script language="javascript" src="/sites/Style%20Library//jquery-1.5.1.min.js" type="text/javascript"></script><script language="javascript" src="/sites/Style%20Library/jquery.SPServices-0.6.0.min.js" type="text/javascript"></script><script language="javascript" type="text/javascript">
    
    $(document).ready(function() {
     var username = $().SPServices.SPGetCurrentUser({
      fieldName: "Name"
     });
    $("textarea[title='People Picker']:eq(0)").val(username);
     $("div[title='People Picker']:eq(0)").text(username); });
     </script>
    
    
    
    
    
    Thanks
    Wednesday, November 13, 2013 6:06 AM
  • Hi Bala,

           I have enabled the"Use this calender to share member's schedule and Resource Reservation " still the Name is not Populating.

    Thanks

    Wednesday, November 13, 2013 6:08 AM
  • I can see double slash in first jquery ref so please remove one or use below code:

    <script language="javascript" src="/sites/Style%20Library/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script language="javascript" src="/sites/Style%20Library/jquery.SPServices-0.6.0.min.js" type="text/javascript"></script>

    Second thing, are both jquery ref files approved in style library? please verify that.


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Wednesday, November 13, 2013 6:16 AM
    Moderator
  • Hi Hemendra,

                    I have removed the another "/" ,  still i'm facing the same problem.

    Thanks

    Wednesday, November 13, 2013 6:25 AM
  • Hi Manikandan,

    In Calendar list against the user name coulmn you canset the default value as [Me] which will automatically populate the logged in user.This will work only for "People or Group" column.

    Regards,


    Sairam Avacorp Technologies

    Wednesday, November 13, 2013 6:30 AM
  • Hi Sairam,

                  This is working fine.

                   Can you suggest for Department field.

    Thanks

    Wednesday, November 13, 2013 6:39 AM
  • What kind of field is department?

    Sairam Avacorp Technologies

    Wednesday, November 13, 2013 6:42 AM
  • Single line of Text.

    Thanks

    Wednesday, November 13, 2013 6:45 AM
  • Here is the full query:userDept and UserTitle are column names

    <script language="javascript" src="/sites/FormSolution/Style%20Library/JavaScript/jquery-1.4.2.min.js" type="text/javascript"></script><script language="javascript" src="/sites/FormSolution/Style%20Library/JavaScript/jquery.SPServices-0.5.4.min.js" type="text/javascript"></script><script language="javascript" type="text/javascript">
    
    $(document).ready(function() {
    	var userTitle = $().SPServices.SPGetCurrentUser({
    		fieldName: "Name"
    	});
    	$("input[Title='Title']").val(userTitle);
    	var userDept = $().SPServices.SPGetCurrentUser({
    		fieldName: "Department"
    	});
    	$("input[Title='Department']").val(userDept);
    });</script>


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    • Proposed as answer by Amy Saraswat Thursday, November 14, 2013 6:44 AM
    Wednesday, November 13, 2013 6:47 AM
    Moderator
  • If you want the department to be loaded from user profile service then you need to use the code what Hemendra has posted above. If not then pls specify from where you want to fetch the department.

    Regards,


    Sairam Avacorp Technologies

    Wednesday, November 13, 2013 6:51 AM
  • Hi Hemendra ,

    we have tried the script but still it's not working, for your information i have attached the screenshot below.

    1. Sharepoint CEWP Html Source

    2. Web Page Fields


    Thanks

    Manikandan

    Wednesday, November 13, 2013 7:49 AM
  • Hi Sairam,

    It's not working we are trying to fetch from the AD, for your information below are the Screenshot.

    1. Active Directory Department Fields

    2. Active Directory Name.

    Thanks

    Manikandan

    Wednesday, November 13, 2013 7:51 AM
  • >Web Page Fields

    change the column name as i said in previous post. You have to provide your department column name instead of "userDept" in script. Second thing is , my script will work for simple text column so not sure about person or group column (as i can see name is person or group datatype).


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Wednesday, November 13, 2013 8:15 AM
    Moderator
  • Hi Hemendra,

                   We have changed the Department field in the script, but still it's not populating. Can you tell me how to check the permission because the name field is working only for sharepoint\system not for any other users.

    In the Library Permission Settings gave read permission for all authenticated Users. Whether this is enough or any other permission need to give ?

    also can you tell me how to verify the permission ?

    Wednesday, November 13, 2013 9:41 AM
  • Hello,

    Read permission is fine now you need to check jquery ref files are published or not. Try below suggestion:

    Go to your site-->view all site content-->style library-->create new folder and upload jquery ref files here. Now approve all files by clicking on ECB menu and click publish link.:

    Now change the path for jquery ref in script as per below

    <script language="javascript" src="/sites/Style%20Library/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script language="javascript" src="/sites/Style%20Library/jquery.SPServices-0.6.0.min.js" type="text/javascript"></script>


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Thursday, November 14, 2013 4:54 AM
    Moderator
  • Hi Hemendra,

                                i tried the above option but still no luck, below are the screenshot. also want tell you  in the permission page it's showing "Limited access" for all my groups, whether this will make any problem ?


    Thanks

    Manikandan

    Thursday, November 14, 2013 7:12 AM