- 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 11:04 AM
Done .. But no luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 11:05 AM
Have you tried with Before Business rule ? Why are you doing?
rec.setWorkflow(false);
rec.autoSysFields(false)
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 08:46 AM
This worked like charm!! rec['work_notes'].setJournalEntry("Manual Worknotes");

- 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 11:16 AM
AFTER removing
rec.setWorkflow(false);
rec.autoSysFields(false); this comments , its working fine
Thanks