3

we are trying to insert data in person and group column name as SecInitiator but it goes in fail. we have 15 lookup column in list. we are able to save/update data but after adding this new column it is giving me this error. any thought on this. we are using office 365 sharepoint online. we are using CSOM (javascript object model)

Below is code

var list_Coll = currentWeb.get_lists().getByTitle('Copy_Approval_Request');
var itemcreateinfo = new SP.ListItemCreationInformation();
var listItem = list_Coll.addItem(itemcreateinfo);
set_peoplePickerValues('SecInitatorfield_TopSpan', 'SecInitiator');
function set_peoplePickerValues(ppfield_TopSpan, ColName)
{
var col_Name = ColName;
var users = new Array();
var username = '';
var username1 = '';
var get_peoplePickerDivObj = SPClientPeoplePicker.SPClientPeoplePickerDict[ppfield_TopSpan]; //alert('get_rush_peoplePickerDivObj\n' + get_rush_peoplePickerDivObj);
var get_peoplePickerDivUser = get_peoplePickerDivObj.GetAllUserInfo(); //alert('get_rush_peoplePickerDivUser\n' + get_rush_peoplePickerDivUser);

for (var i = 0; i < get_peoplePickerDivUser.length; i++)
{
    username = get_peoplePickerDivUser[i].Key;
    users.push(SP.FieldUserValue.fromUser(username));
}
listItem.set_item(col_Name, users);//alert('rush approvar updated\n' + get_rush_peoplePickerDivUser[i].Description);
}

listItem.update();
siteContext.load(listItem);
siteContext.executeQueryAsync(submit_done, submit_fail);

function submit_done()
{
    var itemID = listItem.get_id();
var status = listItem.get_item('Status');
dfd_saveData.resolve(itemID, status);
}

function submit_fail(sender, args)
{
    console.log(args.get_message());
    dfd_saveData.reject(args.get_message());
}
  • Can you please post relevant code block.. Also make sure you are using proper field internal name and not display name. – Amal Hashim May 13 '15 at 12:49
  • your column name is "SecInitiator" while you are passing "SecInitator" to update item is it a typo ? – Akshay Randive May 13 '15 at 13:22
  • I am having the same error, but my field internal name is "TaskInitiator". Is it coincidence? – ECM4D May 13 '15 at 17:01
  • @inferno it is not typo.. i have changed above code.. – Rahul Dayal May 14 '15 at 4:51

Your Answer

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

Browse other questions tagged or ask your own question.