- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 09:33 PM
I have written a BR on change task table to update the worknotes when incident created . its updating the worknotes only when I use current.update(). as current.update is not used in BR so I removed and try to give like this but the worknotes of ctask is not updating.
How to update the worknotes ithout using current.update() in the BR?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 10:21 PM - edited 01-02-2024 10:28 PM
Hi @mounika32
Let's try to change your Business Rules as following
1. When to run
Before update
Conditions: Work notes changes
2. Advanced
(function executeRule(current, previous /*null when async*/ ) {
//insert new Incident [inc]
var inc = new GlideRecord('incident');
inc.initialize();
inc.urgency = 2;
//etc
inc.insert();
current.assigned_to = '';
current.state = 1;
//etc
//set comments
current.comments = 'Incident ' + inc.number + ' has been raised to handle this task since automation failed.';
//remove update();
})(current, previous);
Cheers,
Tai Vu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 09:37 PM
Hi,
Can you please share when to run condition?
If it is before BR then you don't need current.update(); If it is after BR then convert it as Before BR.
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 09:46 PM - edited 01-02-2024 10:15 PM
Hi @Anil Lande
it is after BR, when the worknotes of ctsk changes and it includes error or failed then I am creating incident and updating the worknotes with that comments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 09:46 PM
Hello @mounika32 ,
If you are using After BR, then try below code
grStory = new GlideRecord('rm_story');// Add Your table
grStory.addQuery('sys_id', current.parent);
grStory.query();
if (grStory.next()) {
grStory.work_notes = '[code]<h4>Incident Number ' + inc.number;
grStory.update();
}
Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Vaishnavi Shinde
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 10:21 PM - edited 01-02-2024 10:28 PM
Hi @mounika32
Let's try to change your Business Rules as following
1. When to run
Before update
Conditions: Work notes changes
2. Advanced
(function executeRule(current, previous /*null when async*/ ) {
//insert new Incident [inc]
var inc = new GlideRecord('incident');
inc.initialize();
inc.urgency = 2;
//etc
inc.insert();
current.assigned_to = '';
current.state = 1;
//etc
//set comments
current.comments = 'Incident ' + inc.number + ' has been raised to handle this task since automation failed.';
//remove update();
})(current, previous);
Cheers,
Tai Vu