Use SharePoint people pickers on Project Server or Online PDPs

PDP People PickingProject Server PDPs (Project Detail Pages) have the facility to host Project level enterprise custom fields for users to edit.  Out-of-the-box Project Server supports Cost, Date, Duration, Flag, Number and Text - but not fields of type Person.With the supplied J

5 Star
2,779 times
Add to favorites
Project Server
E-mail Twitter Digg Facebook
  • Return Multiple Entries in Single Field
    5 Posts | Last post November 29, 2019
    • Salutations, James;
        As others have indicated, the ability to return multiple values would be most appreciated.  Even without anything fancy such as returning different values to different fields as you mention being able to do with a variant you have today.  While Microsoft may indeed be working on this, I would prefer to empower people to be Successful today rather than hope for the best tomorrow.  This script by itself has already been incredibly useful.  Thank you very much for your contribution!
    • Got it working with a colleague of mine.  Just update this section and you will save multiple values in a single field:
      //we have a resolved user
      // loop through the users to build up display text
      	var resolvedUsers = this.GetAllUserInfo();
      	var displayText = "";
      	for (i = 0; i < resolvedUsers.length; i++) {
      	displayText += resolvedUsers[i].DisplayText + "; ";
      //Set the underlying field value
      	$('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('value', displayText);
    • Hello everyone.
      If you want to add multiple user, then use this method that I did:
      1) In this place of code write:
      var resolvedUsers = this.GetAllUserInfo();
      var displayText = "";
      for (i = 0; i < resolvedUsers.length; i++) {
          displayText += resolvedUsers[i].DisplayText + "; ";
      displayText = displayText.substring(0, displayText.length - 2);
      $('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('value', displayText);
      $('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('LTValue', displayText);
      2) In this place of code write:
      if (typeof targetValue !== "undefined") {
      		var myUsers = targetValue.split('; ');
      		if (myUsers.length > 0)
      			for (i = 0; i < myUsers.length; i++) {
      				Key: myUsers[i],
      				DisplayText: myUsers[i]
      				}, true);
      		else {
      				Key: targetValue,
      				DisplayText: targetValue
      				}, true);
    • Hello Jason and Apoka, I am still not able to build functionality of multiple selection. I have tried both of your snippets. Please let me know if you got something more yet to be updated here.
    • Answer from Apoka5555 still worked great in project online. I just want to add 1 more setting to remove error message "you can only enter one name".
      there was a schema with name 'AllowMultipleValues' which was set to false change it to true.
      schema['AllowMultipleValues'] = true;
  • Very interesting JS!
    5 Posts | Last post July 18, 2018
    • I am trying to use it to display the AD user name (or display name) and store the email in the custom field. The purpose is to select a user with this people picker that will receive emails from the workflow.
      Any ideas?
    • Tried with:
      //Set the underlying field value
                  $('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('value', resolvedUser.Description);
      As defaultUser.Description = user.get_email();
      But not really sure of what I am doing... so not working yet
    • Ximet,
          Its a bit more complex than that - I have it worked out and will post an update to the script soon.
    • Great work James, thank you so much. I can't believe Microsoft doesn't supply the people picker out of the box just like they do in SharePoint with the "People" column. Any updates on the e-mail capabilities? I would love to utilize this add-on to pick the "Project Approver" for the purpose of my workflow. Thanks a lot.
    • Hi James,
      do you have any update regarding this topic?
      It could be very useful to use in a custom WF
      Regards and thanks in advance.
  • How can I use it sending an email via SPD?
    1 Posts | Last post July 09, 2018
    • I tried it but it doesn´t Works...
  • Project Server 2016
    2 Posts | Last post June 08, 2018
    • Hi James,
      Thanks for this script as I used it in Project Server 2013 for a long time.
      But It seems that the script does not work in Project Server 2016.
      It would be appreciated if you could help.
    • OK, the issue that I had in Project Server 2016 was not related to the script. The script works perfectly in Project Server 2016 too.
      The issue was because of that the machine did not have Internet access to download the JQuery from, so I uploaded the jquery.min.js file to PWA site and load it from there.
      I changed line 9 of the script as follow:
      s.src = '/PWA/SiteAssets/jquery.min.js';
  • Fail on save
    2 Posts | Last post April 09, 2018
    • Hi James!
      Thank you for a nice script.
      I try to add more than one user in the field and save. But only one user (the first one) is saved. 
      Do you have any idea why?
      Thanks in advance.
    • Hi,
      I manage to fix it. But the message appears below: You can only enter one name.
      Do you know how to fix it?
  • Thanks )
    1 Posts | Last post August 11, 2017
  • Troubles with other languages
    2 Posts | Last post August 02, 2017
    • Hi James!
      First, thx for this script! 
      Second, i am from Russia and we have some troubles with this script, when we choose user with russian letters.
      More specifically: if user in (i think) Display Name have a latin letters - all works great (we can add, modify or delete him from specific field). But, if he (user) have a russian letters in Display Name, we just can add this user in field, and user will stay there forever. We cannot modify this field at all. If we change this user (or clear field) and save page, user coming back.
      It's very odd for us.
      May be you have any idea about this situation. 
      Prosvetov Roman.
    • Hi,
      I found a solution for czech characters:
          newPeoplePicker.OnControlResolvedUserChanged = function () {
              if (this.TotalUserCount > 0) {
                  //we have a resolved user
                  var resolvedUser = this.GetAllUserInfo()[0];
                  //Set the underlying field value
                  $('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('value', resolvedUser.DisplayText);
                  $('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('LTValue', resolvedUser.DisplayText);
                  //If value has changed then mark the PDP dirty to enable save
                  //Thankyou to Martin Laukkanen ( for this fix!
                  if ($('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('origvalue') !== $('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('LTvalue')) {
                      WPDPParts[0].IsDirty = true;
              } else {
                  //we have nothing - so clear out the target field
                  $('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('value', '');
      			$('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('LTValue', '');
      			WPDPParts[0].IsDirty = true;
      Best regards
  • Problem with different languages
    4 Posts | Last post June 19, 2017
    • Hello James,
      Thanks for this script as it worked well in PS2013.
      But we encountered a problem with this script when user name with characters like ü, ä, ö, etc.
      If we selected and saved the username contain above characters (as in extended latin alphabets), the display name can be saved into field. But when we try to edit/change to other username, it would not update to the latest display name. It will stay in the field forever and cannot be modified at all. We try to clear this user and save page, the old value came back again.
      Please help us in this odd situation.
      Kindly advice.
    • Yes - that is an odd situation.
      Can you tell me if you have a People Picker in a normal SharePoint list do you have the same issues?
    • People Picker in a normal SharePoint list did not have this kind of issues. Kindly advice on how to resolve this issues?
    • Hello everyone. 
      If you get the error that field cannot changed, then use that:
      $('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('value', displayText);
      $('input#' + (this.TopLevelElementId.split("_PeoplePicker_TopSpan")[0])).attr('LTValue', displayText);
  • Javascript Error
    2 Posts | Last post April 28, 2017
    • Hi James,
      Thank you for posting. This works only intermittently for me.
      I'm getting this JS error: 
      SCRIPT438: Object doesn't support property or method 'when' 
      It's occurring in the function myJQueryCode()
      I've tested this in 2 2013 Sharepoint farms, on IE 10 and IE 11 and get the same results.
      Any ideas why I receive the JS error?
    • Hi Mike,
         It seems that your browser is not loading JQuery successfully.  
      The solution assumes your machine has Internet access to download the JQuery from here: 
      Make sure you can access the above URL from your browser.
  • PS2016 WS2012 R2
    6 Posts | Last post January 30, 2017
    • Bonjour James,
      JE vous remercie pour ce script,j'ai essayé de le copier mais ça marche pas j'ai suivi les étapes mais rien n'a changé.
      N.B.j'utilise Project Server 2016 Windows Server 2012 R2. Merci d'avance.
    • Salut Charlie, excuses, je n'ai pas encore eu l'occasion de le tester sur Project Server 2016, donc si vous pouviez m'envoyer tous les messages d'erreur de la console javascript qui serait génial - et aussi des excuses comme la traduction au français pourrait être terrible.
    • Bonjour James,je vous remercie énormément pour votre réponse,Concernant les messages,ça ne me donne aucune erreur.Je voulais vous envoyer des captures afin que vous puissiez me comprendre mieux.Voilà le lien où j'ai posé ma question au début et c'est Guillaume qui m'a montré votre lien je le remercie.
      Merci d'avance
      Voici le lien:
    • Bonjour James,
      Je vous remercie encore une fois pour votre réponse.J'ai une question s'il vous plait,est ce qu'il y a une autre méthode afin que je puisse sélectionner les noms des manager,ce script m'a aidé mais je vais l'utiliser dans un autre champs mais maintenant je veux un champs comme celui du "Propriétaire" qui est par défaut sur PS2016 dès que je clique sur parcourir il m'affiche tous les noms des commerciaux que j'ai.Merci d'avance
    • Malheureusement, le champ Propriétaire du projet est un champ ayant un comportement spécial vous permettant de parcourir les ressources de Project Server. Project Server ne vous permet pas de réutiliser cette fonctionnalité pour vos propres champs. Malheureusement, je ne sais pas comment faire pour le moment - mais laissez-vous entendre à l'UserVoice for Project:
    • Bonjour James,
      Ok parfait,je vous remercie infiniment pour votre aide.
1 - 10 of 26 Items