setWorkflow(false) not working in script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 07:52 AM
I have a script that we use that allows us to quickly reclassify CIs, basically move them from one table to another, and I am using the line setWorkflow(false); to prevent the business rules from triggering, but for some reason it is not working and the BRs are firing anyways..
var queryStringCI = 'asset_tagINAF268729,AF268723,ADM00117,10794812,10794187,10657191,10657190,';
var CIchg = new GlideRecord('cmdb_ci');
CIchg.addEncodedQuery(queryStringCI);
CIchg.setLimit(10);
CIchg.query();
gs.info("----CMDB\t" + CIchg.getRowCount());
while(CIchg.next()){
CIchg.sys_class_name = 'cmdb_ci_ip_switch'; //table name of class changing too
CIchg.setWorkflow(false);
CIchg.update();
}
Thanks in advance for the assistance...
Andy
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2021 11:19 AM
can you try this script
var queryStringCI = 'asset_tag=AF268729';
var CIchg = new GlideRecord('cmdb_ci_netgear');
CIchg.addEncodedQuery(queryStringCI);
CIchg.setLimit(10);
CIchg.query();
CIchg.setWorkflow(false);
while(CIchg.next()){
CIchg.sys_class_name = 'cmdb_ci_ip_switch'; //table name of class changing too
CIchg.update();
}
Please mark my answer as helpful/correct, if this solves your issue.
Regards,
Sai Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2021 07:58 AM
Hi Andy,
I think current.setWorkflow(false) makes no sense, because you use a GlideRecord and not the current data record.
Maybe you can try setWorkflow(false) before you start the query.
var CIchg = new GlideRecord('cmdb_ci_netgear');
CIchg.addEncodedQuery('asset_tag=AF268729');
CIchg.setLimit(10);
CIchg.setworkflow(false);
CIchg.query();
//gs.info("----CMDB\t" + CIchg.getRowCount());
while(CIchg.next()){
CIchg.sys_class_name = 'cmdb_ci_ip_switch'; //table name of class changing too
CIchg.update();
}
Regards
Marcel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2021 07:44 AM
Hello did you find an answer for this ? I encounter the same issue.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2024 10:35 AM
It seems that the .setWorkflow(false) does not work when reclassifying records. I've encountered the same issue while working with .updateMultiple() and it behaves in the same way. More details in the other thread.