Skip to main content

Search

User details from people picker

Comments

3 comments

  • AdisJ

    Hello Gareth Jayne,

    retrieving user profiles is not supported directly from the expression builder, due to the possible permission/security issues - users who will work with the solution, will need to have appropriate permissions to read those user profiles. Which is not always given.

     

    Anyway, there is a kind of "official" workaround, using JavaScript and calculated expressions in skybow Rich Forms / skybow Solution studio, which is described here:

     

    Selecting User Profile values from the people picker fields 

    Please note that your users will *still* need to have proper permissions to read those profile values. 

    Best regards, and let me know if I can help with anything else,

    Adis

    0
  • GarethJ

    That's great thanks Adis.  Is there a way of using this to populate multiple fields relating to a user field?  In my form I want to display job title, department and office for the user.  I've tried entering the specified code in each of the three fields (making sure the field names are amended for each one) but it seems that only one field can be calculated in this way.  For example if I set the code in the department field only this works but then the other two fields don't update if I enter thee code into them.  If I remove the code from Department and then only enter it into Job Title, the job title field populates but not the other two if I enter code into them.

    0
  • AdisJ

    Hi Gareth Jayne 

     

    yes, that should not pose the problem, just repeat the setting block in "onsuccess" multiple times. Something like this. Repeat the the 3-lines block as often as you need. 

     

    Make sure to:

    • Rename "deparmentText" variable and change the property name ("Department") in the line 1;
    • Rename "departmentController" variable and change the "DepartmentField" (internal name of the field where we want to set the value) in the line 2;
    • Change "departmentController" and "deparmentText" to new variable names in the line 3. 

     

    It should look like:

     

    function onRequestSuccess() {

        // Get a DEPARTMENT property from the UserProfileProperties property.
        var departmentText = personProperties.get_userProfileProperties()["Department"];
        var departmentController = jQuery('span.ms-formbody[fieldname="DepartmentField"]').closest('.ard-formfield').data('Controller');
        departmentController.InstanseData.SetValue(departmentText);

        // Get a MANAGER property from the UserProfileProperties property.
        var managerText = personProperties.get_userProfileProperties()["Manager"];
        var managerController = jQuery('span.ms-formbody[fieldname="ManagerField"]').closest('.ard-formfield').data('Controller');
        managerController.InstanseData.SetValue(managerText);
       
        window.ArdUserInProgress = false;
    }
    0

Please sign in to leave a comment.