Make user VIP when part of a group ?

Floridalife
Giga Expert

We want to manage VIP user using groups, how can i enable the VIP checkbox auto when the user is part of a group ?

1 ACCEPTED SOLUTION

The problem with that is you are needing the business rule to run off the sys_user_grmember table and setting a value in the sys_user table.


Plus, we've determined that it runs when you manually add/remove someone from the group, so the business rule seems to work.



Here is what i would do.


Create a new community post with the question of why is my business rule not running on the LDAP import explaining that it works when you manually add someone to the group, but when the transform map does it, the business rule does not run even when 'run business rules' is checked.


This might find someone who has an answer to respond since this issue is not obvious from the current post question...


View solution in original post

38 REPLIES 38

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Mathieu,



You can create a BR on table "sys_user_grmember" and then as per your logic GlideRecord the target table i.e "sys_user" and set the VIP field for specific user.


Ah gotcha ! can you help me write the script for the advanced tab? not sure what it should look like, i'm very novice in scripting



The group i will use to set VIP will be called Authorized_to_skip_approval


Hi Mathieu,



Sure. You have to create after BR(select insert or update checkbox to true as per your req) and have filter condition i.e group is XYZ(filter condition so that the BR will be trigger only in this scenario) with the script


Script :


(function executeRule(current, previous /*null when async*/) {



  // Add your code here


  var usergr = new GlideRecord('sys_user');


  usergr.addQuery('sys_id', current.user);


  usergr.query();


  while(usergr.next())


  {


  usergr.vip = 'true';


  usergr.update();


  }



})(current, previous);



Thanks ! i get this error when adding that script hough



Missing function declaration for onAfter