Hi,
Use something like this that you trigger on change rule on the field in the “new list”:
function getPPValueFromAnotherList(){
var res, searchVal, item, ppId, ppLogin;
searchVal = getFieldValue("ChoiceColumnInNewList");
res = spjs.utility.queryItems({"listName":"ListNameOfOtherList","query":"<Where><Eq><FieldRef Name='FieldToSearchInOtherList' /><Value Type='Text'>"+searchVal+"</Value></Eq></Where>","viewFields":["PeoplePickerField"]});
if(res.count > 0){
item = res.items[0];
if(item.PeoplePickerField!== null){
ppId = item.PeoplePickerField.split(";#")[0];
ppLogin = spjs.utility.userInfo(ppId).Name;
setFieldValue("PeoplePickerFieldInNewList",ppLogin);
}
}
}
- Change “ChoiceColumnInNewList” with the fieldinternalname of the field in the new list.
- Change “FieldToSearchInOtherList” with the fieldinternalname of the field to find the matching value in the other list.
- Change “PeoplePickerField” with the fieldinternalname of the field in the other list where the person is found.
- Change “PeoplePickerFieldInNewList” with the fieldinternalname of the peoplepicker field in the new list.
- Change “ListNameOfOtherList” with the display name or GUID of the other list.
Hope this helps you on the way.
Alexander
-
This reply was modified 7 years, 8 months ago by Alexander Bautz. Reason: Added missing info