Hi @g h ,
Try to load user object in the code snippet:
var context = new SP.ClientContext.get_current();
var user = context.get_web().get_siteUsers().getById('22');
context.load(user);
context.executeQueryAsync(
Function.createDelegate(null, ensureUserSuccess),
Function.createDelegate(null, onFail)
);
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.