none
Some users don't get picked by ID using people picker script in sharepoint2010 designer

    Question

  •   Hi, I have a workflow that automatically send an email to users that are specified. However, some users doesn't receive that email even though their name pops up in the suggestions drop down list. I can't figure it out because it works fine with most users.

    Note: the forum title is auto generated and contains the email address of the person that created it. Those people who have issues receiving the email; their title field fails to auto generate so it says "no title". Any Ideas
    Monday, May 20, 2019 6:08 PM

All replies

  • You need to see where  is your script picking up the email ID from the make sure you are picking up from  User Profile

    Monday, May 20, 2019 6:34 PM
  • Hi,

    What do you mean that "some users doesn't receive that email even though their name pops up in the suggestions drop down list"?

    How do you choose the user in the workflow? Please share more information for this issue. Some screenshots will be better if possible.

    Best Regards,

    Michael Han


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, May 21, 2019 9:30 AM
  • This is the script, it was made by another developer. Also the users that doesn't receive the email have full control permissions. I have the workflow screen in the blew comment. Thank you... 

                           <script type="text/javascript">

    initializePeoplePicker('divSupervisorName'); 

    function initializePeoplePicker(peoplePickerElementId) {

    // Create a schema to store picker properties, and set the properties.
    var schema = {};
    schema['PrincipalAccountType'] = 'User';
    schema['SearchPrincipalSource'] = 15;
    schema['ResolvePrincipalSource'] = 15;
    schema['AllowMultipleValues'] = false;
    schema['MaximumEntitySuggestions'] = 50;
    schema['Width'] = '275px';
    schema['Height'] = '55px';

    // Render and initialize the picker. 
    // Pass the ID of the DOM element that contains the picker, an array of initial
    // PickerEntity objects to set the picker value, and a schema that defines
    // picker properties.
    SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, null, schema);
    }

    // Query the picker for user information.  
    // PeoplepickerId = Id of the people picker
    function getUserInfo(PeoplepickerId) {  
        UsersID = '';
    // Get the people picker object from the page.  
    var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict[PeoplepickerId + "_TopSpan"];  
    if (!peoplePicker.IsEmpty()) {  
    if (peoplePicker.HasInputError) return false; // if any error  
    else if (!peoplePicker.HasResolvedUsers()) return false; // if any invalid users  
    else if (peoplePicker.TotalUserCount > 0) {  
    // Get information about all users.  
    var users = peoplePicker.GetAllUserInfo();  
    var userInfo = '';  
    var promise = '';  
    for (var i = 0; i < users.length; i++) {  
    UsersID += GetUserID(users[i].Key);  
    }  
    return UsersID;  
    }  
    } else {  
    return UsersID;  
    }
    }

    // Get the user ID.  
    function GetUserID(logonName) {  
    var item = {  
    'logonName': logonName  
    };  
    var UserId = $.ajax({  
    url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/ensureuser",  
    type: "POST",  
    async: false,  
    contentType: "application/json;odata=verbose",  
    data: JSON.stringify(item),  
    headers: {  
    "Accept": "application/json;odata=verbose",  
    "X-RequestDigest": $("#__REQUESTDIGEST").val()  
    },  
    success: function(data) {  
    return data.Id + ';#' + data.Title + ';#';  
    },  
    error: function(data) {  
    failure(data);
    }  
    });  
    return UserId.responseJSON.d.Id + ';#' + UserId.responseJSON.d.Title + ';#';  
    }

    function SetAndResolvePeoplePicker(fieldName, userAccountName) {
       // alert(userAccountName);
    var _PeoplePicker = $("div[title='" + fieldName + "']");
    var _PeoplePickerTopId = _PeoplePicker.attr('id');
    var _PeoplePickerEditer = $("input[title='" + fieldName + "']");

    userAccountName.split(";#").forEach(function (part) {
       if (part !== "" && part !== null) {
      //  alert(part);
    _PeoplePickerEditer.val(part);
    var _PeoplePickerOject = SPClientPeoplePicker.SPClientPeoplePickerDict[_PeoplePickerTopId];
    _PeoplePickerOject.AddUnresolvedUserFromEditor(true);
       }
    });
    }
    </script>


    • Edited by Guest1993 Tuesday, May 21, 2019 1:24 PM
    Tuesday, May 21, 2019 1:14 PM
  • this is the workflow and script is in the above comment. As i mentioned it works fine with most users, and the people that it doesn't find have full control permissions. people name is chosen by a script, their "names pops up"  that means sharepoint recognize the name, its in the system. but i don't know the issue. thank you


    • Edited by Guest1993 Tuesday, May 21, 2019 1:22 PM
    Tuesday, May 21, 2019 1:19 PM
  • Hi,

    Sorry for the delay reply. 

    Sine the workflow works with most users, the workflow doesn't have any issues. Something may be wrong with the custom scripts. You need to ask the developer why the script does not work for user with full control permission.

    Best Regards,

    Michael Han


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, June 3, 2019 6:56 AM