The below code is working fine in chrome but not working for IE.

    var clientContext = new SP.ClientContext(siteURL);
    var oList =clientContext.get_web().get_lists().getByTitle('MasterNotification');
    var newItem = new SP.ListItemCreationInformation();
    this.item = oList.addItem(newItem);

It's giving below error:

SCRIPT438: Object doesn't support property or method 'set_item'


You have created item by using "this" object, so while accessing also you need to use "this". change this




or just delete "this". and use var

var item = oList.addItem(newItem);

if you want to use the same 'item' variable in other functions call the other function with this parameter in your success callback. you cannot execute the other function without calling this function. So change your code to use callbacks or you can use jQuery differed Objects to manage the async calls(but it will be confusing for the beginners). change the executeQueryAsync as follows.

    //call the other function with parameter
    }), function(s,a){alert(a.get_message())});

    function myOtherFunction(item){


the cleaner way is using deferred object or call your function with callbacks like

   function createItem(successcallback,failcallback){
    //...code to create item

   function functionUsingItem(item){

   function functionToShowError(errMsg){

call the createItem method like

  • The this.item.set_item("NotificationNumber",WONumber) is not working but 2nd suggestion is working but i want to use the item globally.So now i created a global variable and set the item value to it.but it is not correct way.can u have a other way. – sachin Aug 21 '15 at 7:24
  • Do you want to use the variaable in a seperate JS function? how are you calling the executeQueryAsync, are you using callback functions? – sekhar Aug 21 '15 at 15:22
  • Ya Exactly.I want to use the variable in a separate js functions and other functions. – sachin Aug 21 '15 at 15:41
  • clientContext.executeQueryAsync(Function.createDelegate(this, this.onsaveEditLaborItem), Function.createDelegate(this, this.onQueryFailed)); – sachin Aug 21 '15 at 15:43

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.