- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 01:20 AM
Need to write business rule where worknotes contains "My Laptop Issue" then only it should assigned to specific assignment group.
I have written br its not working.Please guide me in this.
var gr = new GlideRecord('sc_task');
gr.query();
if (current.work_notes == 'My Laptop Issue') { gr.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 04:14 AM
Hi,
update your script as this
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if (current.work_notes.getJournalEntry(1).indexOf('My Laptop Issue') > -1 ) {
current.assignment_group = "groupSysId"; // give group sysId here
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 01:50 AM
You dont need script for this.
BR on SC Task table before insert/update
Condition :
Worknotes contain MY Laptop issue
AND
Assignment group to groupname
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 04:12 AM
Hi Shweta,
Your script looks incomplete to me. On which table this BR is written and on which record you want to update the assignment group.
If you want to update the assignment group on same table then please try below,
if (current.work_notes == 'My Laptop Issue') {
current.assignment_group="group_sys_id_here" //store it in system property as best practice
}
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Community Rising Star 2022
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 04:14 AM
Hi,
update your script as this
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if (current.work_notes.getJournalEntry(1).indexOf('My Laptop Issue') > -1 ) {
current.assignment_group = "groupSysId"; // give group sysId here
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 04:18 AM
Use before insert/update BR with condition worknote changes
var gr = new GlideRecord('sys_journal_field');
gr.addQuery('element_id', current.sys_id);
gr.addQuery('name', 'incident');
gr.addQuery('element', 'work_notes');
gr.query();
while (gr.next()) {
if (gr.value.toString() == "My Laptop Issue"){
current.assignment_group = sys_id of the assignment group;
}
}