Skip to main content
Source Link
Shomit
  • 35
  • 10

Bug in Updating SharePoint list via javascript

here is My code :

console.log(query);
camlQuery.set_viewXml(query);
collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(function (sender, args)
                                    {
                                        var itemArray = [];
                                        var i=0;
                                        var listEnumerator = collListItem.getEnumerator();
                                        while (listEnumerator.moveNext()) 
                                        {
                                          
                                                var listItem = listEnumerator.get_current();
                                                var item=listItem.get_item('ID');
                                                
                                                listItem.set_item('Flex_status',hash [item][7]);
                                                listItem.set_item('Payroll_recieved_date',hash[item][8]);
                                                listItem.get_item('Flex_Paid_Date',hash[item][9]);
                                                listItem.get_item('Payroll_Comments',hash[item][10]);
                                                
                                                listItem.update();
                                                itemArray.push(listItem);
                                                clientContext.load(itemArray[itemArray.length-1]);
                                        }
                                        clientContext.executeQueryAsync(function (sender, args)
                                                                        {
                                                                            alert('done...');
                                                                            $('#hh').modal('toggle');
                                                                        }, function (sender, args)
                                                                        {
                                                                            
                                                                            alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
                                                                            $('#hh').modal('toggle');
                                                                        });

                                    },function (sender, args)
                                    {
                                        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());

                                    //$('#hh').modal('toggle');
                                    });

The Problem is got the alert saying done but when i refreshed the list my items were not upgraded...i have cross checked every variable in debugger...Can any one help me please