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.
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.
Thanks for the info Andrew-- I had no Idea they added that to the CSOM!
Still seems like it could be a security issue if a user can update any metadata on a list without having temselves tagged as the last update user.
- Dec 07, 2016
I believe that a user should be a member of Site Owners or site collection admin to be able to execute systemUpdate.
- avanadesharepointmanApr 06, 2019Copper Contributor
Andrew Koltyakov - Would you happen to know an all encompassing PS script that can be used to stop SP WFs, update user identities on the WF and then restart all SharePoint Workflows? We're in the process of migrating an online secure tenant to GCC SharePoint tenant and the user identity mappings are changing. So, I was looking to see if this is possible to do using a PowerShell script. I've turned over many rocks during my online search, but can't seem to find a script that comes close to doing the described functions.
Thanks for any help or advise you can offer
Vincent T.