People Picker Error

Hello I am trying to set the people picker value of the current logged in user with the below code.

fd.field("Employee").value = _spPageContextInfo.userLoginName;

the name of the current user is displaying correctly in the people or groups field but when I save the form its throwing an error saying "Couldn't find exact match". If you delete the value in the field, and select again, it works fine.

(I saw somebody else posted a similar issue and deleted it)

1 Like

Hi @sphilson.

Please make sure to wrap your people picker field with the ready method.

fd.field('Employee').ready().then(function(field) {
    	fd.field('Employee').value = _spPageContextInfo.userLoginName;	
});

This should resolve your issue.

2 Likes

This worked! Thank you!