I am creating a new list item using CSOM. When I try updating a Person field, I'm getting a error saying my function is undefined

Uncaught ReferenceError: createListItem is not defined

it happens with the introduction of this line:

SP.User _newUser = clientContext.Web.EnsureUser("domain\\user");

Isn't this part of Sp.js? I have this imported along with sp.core.


Try this

var context = SP.ClientContext.get_current();
var theUser = context.get_web().ensureUser("DEV\testowner");

    //Create list item here
function(sender, args){
  • perfect! I just needed to add an extra backslash and it worked thanks Amal. ("DEV\\testowner") – Michael Colbs Oct 30 '14 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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