Forum Discussion

Brent Ellis's avatar
Brent Ellis
Silver Contributor
Dec 05, 2016
Solved

CSOM Update without triggering workflow - SharePoint Online

I seem to recall someone saying / writing that updates were coming to SharePoint Online CSOM where you could update a list item without triggering workflows (like you can on prem), did that ever come...
  • Andrew Koltyakov's avatar
    Dec 07, 2016

    Hi there,

     

    SystemUpdate is presented in CSOM/JSOM too, actually. It was added in SPO sometime before and seems like it works very close to SSOM's method:

     

    • No editor and modified date information is updated,
    • No version is created,
    • But workflow with an on edit trigger, unfortunately, starts,
    • Not sure about RERs, likely they are fired as well.

     

    Here is a sample in JavaScript (should be executed on classic display or edit form):

     

    var clientContext = new SP.ClientContext.get_current(); 
    var oList = clientContext.get_web().get_lists().getById(_spPageContextInfo.pageListId);
    var oListItem = oList.getItemById(GetUrlKeyValue("ID"));
    oListItem.set_item('Title', 'New title');
    oListItem.systemUpdate();
    clientContext.executeQueryAsync(
        function() {
            console.log('Item has been updated');
        },
        function(sender, args) {
            console.log('Error: ' + args.get_message() + ' ' + args.get_stackTrace());
        }
    );

    Didn't check if the CSOM (C#) behavior is the same.

    Anyway, maybe it will be helpful.

Resources