Skip to content

Commit 7e8bba9

Browse files
code_snippet.js
1 parent acf0dd4 commit 7e8bba9

File tree

1 file changed

+12
-0
lines changed
  • Server-Side Components/Business Rules/Dynamic GlideList Field Sync

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This script sync all related assignment groups when a record’s department changes and this business rule runs After Update
2+
(function executeRule(current, previous) {
3+
if (current.department.changes()) {
4+
var grp = new GlideRecord('sys_user_group');
5+
grp.addQuery('u_department', current.department);
6+
grp.query();
7+
var list = [];
8+
while (grp.next()) list.push(grp.sys_id.toString());
9+
current.assignment_group = list.join(',');
10+
current.update();
11+
}
12+
})(current, previous);

0 commit comments

Comments
 (0)