- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 04:31 AM
We are importing several groups from our Active Directory. Now we want to set a boolean variable to true if a user is in a group which is starting with "Group_" => e.g Group_A, Group_B.
How is this possible? After an AD sync - ServiceNow should check if there were members added or removed and set the boolean to true or false.
Thank you!
Simon
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 08:41 AM
We solved this with 2 Business rules (one for adding and for removing the user). IMPORTANT: Your group needs a role otherwise it will not work with the AD sync.
Content of the "add business rule"
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", current.user);
gr.query();
while(gr.next()) {
gr.setValue("u_keyuser", "true");
gr.update();
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 04:52 AM
Could you provide some screenshots please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 05:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 08:41 AM
We solved this with 2 Business rules (one for adding and for removing the user). IMPORTANT: Your group needs a role otherwise it will not work with the AD sync.
Content of the "add business rule"
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", current.user);
gr.query();
while(gr.next()) {
gr.setValue("u_keyuser", "true");
gr.update();
}
})(current, previous);