Using the SharePoint COM to update a list item, but my function is failing.
function updateProjectEC(projID, totalEC)
{
if(totalEC !== 0)
{
console.log("projID: " + projID);
console.log("totalEC: " + totalEC);
var siteUrl = '/ats/CFPC';
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('Projects');
this.oListItem = oList.getItemById(projID);
oListItem.set_item('TotalEarnedCost', totalEC);
oListItem.update();
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
}
Code is modeled after the MSDN example:
http://msdn.microsoft.com/en-us/library/hh185011%28v=office.14%29.aspx
Which I've gotten to work before, but here it is failing at:
var clientContext = new SP.ClientContext(siteUrl);
With the error:
SCRIPT445: Object doesn't support this action
I've used this set-up previously, in another function contained in a separate CEWP on the same page even, and it works fine. Not sure why this one is breaking down.
Thanks in advance for any assistance.