Updating a list Item including a User or Group Column

Feb 2, 2016 at 2:21 PM
Hi Marc,

Below is the code for the function I am using to update a list item. My list contains information about manager (ID, Name, email). When list item is created it can either have ID of manager or can be blank. If ID is there, Name and Email fields are filled automatically. What I am trying to do in this function is if Manager information is not in the list then user who is making a request is asked to update manager ID which I am storing in a variable and then passing to this function but my item is not updating.

function UpdateListItem(currentItemId, listName, column, idvalue)
{
alert(currentItemId);
alert(listName);
alert(column);
alert(idvalue);

var userManager = $().SPFindPeoplePicker({
                    peoplePickerDisplayName: column
                });

userManager.currentValue = idvalue;
var listColumns;
listColumns = [[column,userManager.currentValue]];
alert(listColumns);

$().SPServices({
    operation:"UpdateListItems",
    async: false,
    batchCmd: "Update",
    listName: listName,
    ID: currentItemId,
    valuepairs: listColumns,
    completefunc:function(xData, Status)
    {
        alert(xData.responseText);
    }
});
}

Regards,

BAB
Coordinator
Feb 2, 2016 at 2:26 PM
Are you getting any errors in the response? Are you sure that userManager.currentValue is a userId?

M.
Feb 2, 2016 at 2:31 PM
Yes Marc, I have debugged it and the alerts are showing userManager.currentValue is the value I am passing through variable (a UserID). I cannot see any error except when is used 'alert(xData.responseText)'

BAB
Coordinator
Feb 2, 2016 at 2:43 PM
You'll need to look at the request and the response in the debugging tools to see what the problem is. Does xData.responseText show you anything?

M.