Issue with Set People Picker/Group field value

Hello,

I'm contacting you because I'm currently having a problem filling a People Picker field based on the loginname of the connected user.

When I open my New Form, the user's name is entered in my field, with the good user selected, but when I validate, the value doesn't seem to be saved.

NewForm

You can see below that the column is empty after saving :

File2

However, if I delete the value and re-enter it manually, the registration works.

There is my code :

fd.spRendered(function() { 
    
    var userName = _spPageContextInfo.userLoginName;    
    fd.field('Utilisateur_x0020_concern_x00e9_').value = userName;
    
});

Can you please help me with this strange problem which is driving me crazy ! :dizzy_face:

Thanks for your help :slight_smile:

Automatic answer for myself ... I found the solution, and here it is below.

The solution was to use ready(function(field)

Thanks anyway :smiley:

fd.spRendered(function() { 
    
    fd.field('Utilisateur_x0020_concern_x00e9_').ready().then(function(field) {
    	fd.field('Utilisateur_x0020_concern_x00e9_').value = _spPageContextInfo.userLoginName;	
    });
    
});
2 Likes