1

I am using javascript to write the client object model code in SharePoint 2013. I want to update a column of the form library but I am not able to do it. The code goes in the onFailure method without giving any sort of exception. Please guide regarding how to update the column value and how can I debug this code.

The following is the code for updating:

      currentItem.set_item('_Status', 'Approved');
      currentItem.update(); 
      context.executeQueryAsync(on_myUpdate_Success, on_myUpdate_Failure);    

The onsuccess and onfailure functions are:

       function on_myUpdate_Success() {
            alert('Updated Successfully.');
        }
      function on_myUpdate_Failure(sender, args) {
          alert('Error while updating the data. Error: ' + args.get_message() + ' StackTrace: ' + args.get_stackTrace());
          ULS.enable = true;
          ULSOnError('Error while updating the data mansi' + args.get_message(), document.location.href, 0);
          //if debugging
          alert(args.get_message());
      }

Please guide.

1

I'm not sure how you are getting the current item, but info on how to update an item using javascript is found here http://msdn.microsoft.com/en-us/library/hh185011(v=office.14).aspx.

Are you doing this within an App? Can you get the current item? For debugging I normally use Chrome developer tool (F12). Then step through the code and use watch windows and/or console. It is also possible to debug in Internet Explorer using its developer tool, but I find Chrome easier to use.

  • The current item value is obtained correctly, I have checked it. I need to write a log file or debug the code so that I can troubleshoot the problem. Please let me know how can I debug the code in chrome? – Mancy Desaee Sep 13 '13 at 9:00
  • developers.google.com/chrome-developer-tools Basically once you have the toolbar up, you goto sources, find your file with the JavaScript on, and then click on the left to make a breakpoint. Run the page again and Chrome will stop at your break point. You can then F10/F11 to step through, or F8 to continue running. Use the Watch Expressions on the right to add objects to watch, or type in the console. On the Dev Tools, click the cog icon for settings and Shortcuts. – Cann0nF0dder Sep 13 '13 at 11:28

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.