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
12-18-2015 12:40 PM
You could write it directly to the sys_journal_field table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 01:42 PM
Hi I know this is extremely old thread, but I have a very similar issue that the Original is referring to. How would you fix the following script to write the contents of the "u_comments" field to the sys_journal_field table?
var gr = new GlideRecord("time_card");
gr.addQuery("task", "e2e2f4aa4f6fef4063bc4b5e0210c759");
gr.setLimit(1);
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.query();
while (gr.next()) {
var comment = gr.getValue("u_comments");
/*gr.setValue("notes", "comment");*/
gs.log(comment);
gr.notes = comment;
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2016 06:10 AM
Hi Eric,
I have come across the similar issue now, i use the below two before using update(), function, it does not update the work notes.
//rec.setWorkflow(false); //IMPORTANT: ensures the impending update does not trigger business rules
//rec.autoSysFields(false); // IMPORTANT: ensures the impending update does not modify updated date, updated by, or update count.
Were you able to solve this issue?
Regards
Yoigsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2016 06:18 AM
Hi Eric,
Please proceed as Mark specified ... The reason being , data from these journal fields copied to sys_journal_field table using some Business Rule at backend. When you set workflow to false , that BR get Skipped as well.