- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 10:54 AM
Hi All
When ever the User get inactive i want to update the incident worknotes please reassign the ticket to some one.
I used follwing business rule in SYS_USER table and AFTER / UPDATE condtion.
But i not able update the worknots. Please some one help me to fix this issue.
(function executeRule(current, previous /*null when async*/) {
var rec=new GlideRecord('incident');
rec.addQuery('assigned_to',current.sys_id);
rec.addQuery('active',true);
rec.addQuery('state','!=',6); /
rec.query();
while(rec.next()){
rec.assigned_to = '';
rec.work_notes = "Manual Worknotes";
rec.setWorkflow(false);
rec.autoSysFields(false); rec.update();
}
})(current, previous);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 11:10 AM
HI,
So when we write a setWorkflow(false) it will not update the journal entry table and audit tables. Because no business rule will run and then hence worknotes will not get updated in activity log and in respective tables.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 10:58 AM
This is because of " rec.setWorkflow(false); ", as this will prevent BR running which used to run because of this action.
BR needs to run to push the work notes update to the activity log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 11:02 AM
Please brief more .. Am not clear

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 11:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 11:02 AM
Try this:
(function executeRule(current, previous /*null when async*/) {
var rec=new GlideRecord('incident');
rec.addQuery('assigned_to',current.sys_id);
rec.addQuery('active',true);
rec.addQuery('state','!=',6); /
rec.query();
while(rec.next()){
rec.assigned_to = '';
rec['work_notes'].setJournalEntry("Manual Worknotes");
rec.setWorkflow(false);
rec.autoSysFields(false); rec.update();
}
})(current, previous);
Please mark as Correct Answer and Helpful, if applicable.
Thanks!
Abhishek Gardade
Hexaware Technologies
Abhishek Gardade