I have the following code.
I can update the title field but not the people/group field. I am not sure why the following code does not work.
The value 8 is the group id I am trying to update the field with.
Thanks for your help.
<script src="Mysite/SiteAssets/jquery-3.3.1.min.js" type="text/javascript"></script><script type="text/javascript">
$( document ).ready(function() {
UpdateMetaData();
});
function UpdateMetaData(){
var listname = 'Mylist';
alert(listname);
var id = 1;
var ProgramGroupId = 8;
alert(ProgramGroupId);
var ctx = SP.ClientContext.get_current();
var oList = ctx.get_web().get_lists().getByTitle(listname);
this.oListItem = oList.getItemById(id );
oListItem.set_item('ProgramManager', ProgramGroupId);
oListItem.update();
ctx.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
alert('Item updated!');
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
faye fouladi