Bhargava Ch
How to update item from JSOM REST call using jquery write down the code?

How to update item from JSOM REST call using jquery write down the code?

By Bhargava Ch in SharePoint on Nov 29 2019
  • Rohit Ahuja
    Jun, 2021 4

    The other answer is incomplete. UpdateQueryAsync was missing which does the actual write opration on the server. Below is complete piece of code.

    function UpdateItem() {
    clientContext = new SP.ClientContext.get_current();
    oList = clientContext.get_web().get_lists().getByTitle(‘ListName’);

    this.oListItem =oList.getItemById(1);

    oListItem.set_item(‘Title’, ‘My Updated New Title’);

    oListItem.update();

    clientContext.load(oListItem);

    clientContext.executeQueryAsync(
    Function.createDelegate(this, this.onQueryInsertSucceeded),
    Function.createDelegate(this, this.onQueryInsertFailed));
    }

    function onQueryInsertSucceeded() {
    alert(‘Item Updated: ‘);
    }

    function onQueryInsertFailed() {
    alert(“Item Update Failed”);
    }

    • 0
  • Sanjay Makwana
    Dec, 2020 25

    1. function updatelistitem() {
    2. var clientContext = new SP.ClientContext(https://****.sharepoint.com/sites/demo");
    3. this.oListItem = oList.getItemById(3);
    4. var oList = clientContext.get_web().get_lists().getByTitle('Announcements');
    5. oListItem.set_item('Title', 'My Updated Title');
    6. oListItem.update();
    7. }

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS