Trying to use setWorkflow(false) and update work_notes this does not seem to allow journal fields to be updated when false string fields seem to work ok. Does anyone know how to update work_notes without causing BR to fire
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2015 12:02 PM
UpdateTasks();
function UpdateTasks() {
if (current.sys_id == '') {
return;
}
gs.log('Current user ID 1');
var tasks = new GlideRecord('sc_task');
tasks.addQuery('parent', current.sys_id);
tasks.query();
while (tasks.next()) {
gs.log('Current user ID 2' + current.comments);
tasks.close_notes = '8989890';
tasks.work_notes = '12345';
tasks.setWorkflow(false);
tasks.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 04:26 AM
I has an issue with two updates, so my solution was:
setWorkflow(false);
setValue('some_field', 'somevalue');
update();
setWorkflow(true);
work_notes = 'blabla';
update();
This way, the workflow will not run during the first part, and then run during the part where I update the work note. Might not work for everyone, depending in what you want to accomplish, but might be the solution to some
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2017 03:09 AM
It worked like a charm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 09:17 AM
I was having the same issue, and was able to work this out. Update the work notes field first, then do a second ".update()" with the "setworkflow(false)". See my script below.
var gr_inc_resolved = new GlideRecord('incident');
gr_inc_resolved.addEncodedQuery(query_inc_resolved);
gr_inc_resolved.query();
while (gr_inc_resolved.next()) {
gr_inc_resolved.u_state_reason = "QA Verified Successful";
gr_inc_resolved.work_notes = "Incident is auto closed after 7 days";
gr_inc_resolved.update();
gr_inc_resolved.state = 7; // Closed
gr_inc_resolved.setWorkflow(false);
gr_inc_resolved.active = false;
gr_inc_resolved.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 02:22 AM
Hi @eroth ,
Setworkflow false restrict update of work-notes field.
Please mark itcorrect answer and helpful if it resolve the issue.
Thanks,
Brijesh Sahani