Forum Discussion
CSOM Update without triggering workflow - SharePoint Online
- 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.
This is apparently a thing in on premise, maybe in on prem CSOM it's called a SystemUpdate()
I believe it would allow you to run scripts without incrementing versioning or triggering workflows on item changes.
- Russell GoveDec 07, 2016Iron Contributor
SystemUpdate is not available in CSOM on prem, it's only in the server side object model. it allows you to update items without affecting last update user /time or running workflows. It is meant to be used by trusted code. I guess it's not in the csom because if it were, anyone who had update authority to a list would be able to make a simple ajax call from their browser and change the last update user/time or running any workflows,
there would have to be some changes to the security model before they would ever allow this in the csom.