0

I have a small requirement where in i need to populate Managers Name and Leads Name (People Picker Field) based on value entered in another People Picker Field which is Employee Name in Vacation List.

The Employee name are mapped to Managers name and leads name in another list which is Master List.

Requirement: As the user opens the new form and puts his name in Employee Name field, the manager name and leads name people picker field should auto populate from Master List.

7
  • Do you need it to be populated for the user to see, or can you accept it being added upon submitting the form?
    – Morten K
    Apr 10, 2019 at 7:53
  • i would want it for the user to see also if it is getting saved after the form is submitted, i have flow attached to the list which goes for approval and i do not want my flow to get hampered. but could you kindly give me option of getting the names after the form is submitted Apr 10, 2019 at 7:54
  • I would do it using a SharePoint designer workflow and simply having it look up the manager and add it to the list. But since you're using Flow I don't think that's an option for you (Flow might trigger before the SPD workflow has executed). Then the only real option I see is to write a custom javascript to grab the value of the people picker, then look up in the list and finally add the manager to the new field. IT shouldn't be too difficult if your familiar with JS.
    – Morten K
    Apr 10, 2019 at 8:06
  • Is there any link i can refer to as i am not that familiar with JS Apr 10, 2019 at 8:28
  • Oh they I would ask somebody to help you out. But you could start out here: codecademy.com/learn/introduction-to-javascript
    – Morten K
    Apr 10, 2019 at 8:32

2 Answers 2

0

There are two methods, check if they’re feasible for your requirement:

  1. Edit the new form page and insert Content Edit web part, add javascript code to get column value from another list and populate it in current form.Similar post for JS

  2. Use InfoPath to customize form, add master list as secondary connection and set the column default value with the master list volume value. Similar post for InfoPath

1
  • The post for JS is based on a dropdown selection but what i want is that as i put in the name of employee in People Picker field 1 it should populate people picker field value 2 and 3 from master list Apr 10, 2019 at 7:36
0

You can retrieve user Login and User Display name and then you can use function(below) to resolve people picker.

var currentUserLMEntry = createUserEntity(currentUserData.managerLogin, currentUserData.managerDisplayName);
function createUserEntity(userLoginName, userDisplayName)
{
return {
  Description: userLoginName,
  DisplayText: userDisplayName,
  EntityGroupName: "",
  EntityType: "",
  HierarchyIdentifier: null,
  IsResolved: true,
  Key: userLoginName,
  MultipleMatches: [],
  ProviderDisplayName: "",
  ProviderName: ""
};
}
3
  • Raaf as i spoke about my requirement, i cannot pull in the managers name through user property. i have to pull it out from another list as this the requirement. Apr 10, 2019 at 11:18
  • You can retrieve managers name through REST service or through CSOM
    – Raf
    Apr 10, 2019 at 11:20
  • I am not quite aligned on how to use these services. is there any reference i can follow through which i can perform my requirements Apr 10, 2019 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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