0

Using Sharepoint Designer 2010 and no access to Foundation, VB, or installation of third-party software, is it possible to do the following:

  1. I have a People or Group column called Student Name. It allows the users to search our AD database and captures the name.
  2. I would like a second column next to it, called Student Email, that auto fills the email associated with the person in Student Name.

Unfortunately, I don't have access to making customized code, but might be able to inject Javascript with a little help.

Is there any way to do this dynamically?

2

You can leverage SPServices http://spservices.codeplex.com/. Download the js library file and upload it into a SharePoint library (ex Site Assets)

Then edit the page in question, add a content editor webpart and link the JS files.

Now handle the onchange event of the text box where the search is happening, then use SPServices http://spservices.codeplex.com/wikipage?title=GetUserProfileByName method to get additional information of the selected user.

And populate the email of the selected user.

  • Does this work for normal lists? I'm just looking to edit a list, not a separate page. – nicolefdesigns Jan 12 '15 at 15:26
  • Yes you can edit the list (new/edit form) page and add a script editor webpart. You can use browser developer tools to find out the html tag id's for hooking up the events. – Amal Hashim Jan 12 '15 at 15:28
  • Thank you. Could you explain the Javascript in your answer a bit more? I'm still a beginner at Javascript unfortunately. – nicolefdesigns Jan 12 '15 at 15:35
  • Ok. The SharePoint page you are talking about is rendered as HTML objects. The people control is a text box where users can type. So using JavaScript add a keydown event handler and capture the data. In the same handler using the value in the textbox, invoke a SPServices call to getuserprofilebyname. This will return you the details of the selected user in XML format. You can use that to find the Email and populate another element (ex a textbox) – Amal Hashim Jan 12 '15 at 15:38
  • Thank you for that explanation. I may be grabbing the wrong code but I don't believe this is working. Do you mind looking over my code? – nicolefdesigns Jan 12 '15 at 16:53
0

Using the SPJS Utility and SPJS Autocomplete libraries, I was able to implement this dynamically with the following code:

//intialize fields
fields = init_fields_v2();

//Autocomplete email column from name column
spjs.ac.peoplePicker({
"applyTo":"Student_x0020_Name",
"forceOn2013":false,
"helpText":"Enter name or email address...",
"showField":"Title",
"chooseFromUserGroup":null,
"showUsersOnly":true,
"rowLimit":5,
"listOptionsOnFocus":false,
"reValidateOnLoad":false,
"setFields":[
    {
        "fromFIN":"EMail",
        "toFIN":"Student_x0020_Email",
        "skipIfEmpty":false
    }
]
}); 
  • Nice to hear you completed the task! Cheers!!! – Amal Hashim Jan 14 '15 at 14:59
  • Thank you! My knowledge of Javascript is limited so I appreciate all your help. – nicolefdesigns Jan 14 '15 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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