Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 09:39 AM
Hello friend,
How can I call the script include from the Business Rule. I created the following script include and BR (condition is when active = false) and it is not working.
Script Include: var u_removeRolesGroupsFromUser = Class.create(); u_removeRolesGroupsFromUser.prototype = { initialize: function() { }, removeGroups: function(user) { //Query Group Membership table, loop through all groups and remove them the from User's profile var group = []; var gm2m = new GlideRecord('sys_user_grmember'); gm2m.addQuery('user', user); gm2m.query(); while(gm2m.next()) { //as each group is being added to the array, delete that group so no duplicates are displayed in the user record log. group.push(gm2m.group.name); gm2m.deleteRecord(); } this.updateUserRecord(user, group); }, type: 'u_removeRolesGroupsFromUser' }; |
Business Rule: var x = new u_removeRolesGroupsFromUser(); x.removeGroups(); |
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 10:16 AM
Hi @hongsok
update your BR script
var x = new u_removeRolesGroupsFromUser();
x.removeGroups(current.getValue('sys_id'));
this.updateUserRecord(user, group); //where is this updateUserRecord method definition? in
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 10:16 AM
Hi @hongsok
update your BR script
var x = new u_removeRolesGroupsFromUser();
x.removeGroups(current.getValue('sys_id'));
this.updateUserRecord(user, group); //where is this updateUserRecord method definition? in
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya