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

also this should be set to AFTER, not before right?


Remove the quotes from 'true'. You are trying to set a Boolean field with a string.


just   true   should work.



You could also simplify your code to this



function onAfter(current, previous) {


  //This function will be automatically called when this rule is processed.


  var usergr = new GlideRecord('sys_user');


  usergr.get(current.user);


  usergr.vip = true;


  usergr.update();


}



Setting VIP to false would be the same code, just set VIP to false and have the Business Rule run on delete instead of insert and update.


I tried your code but no luck either, here is the value i need to update, also the users gets added to the SN group via LDAP sync, i dont add the user manually, not sure if that makes a diff



2016-05-03 15_58_16-ServiceNow.png


Hmmm.


I did the same exact code in my dev instance and it sets the value fine.


LDAP shouldn't matter as the business rule will fire regardless. What I am now wondering is if you have some sort of ACL limitation.


Are you able to set the field manually on the user record?  


Another option to maybe try is use another text field, like title, and just set it to usergr.title = 'Business rule worked'; or something to just see if it is VIP field related.


Half a Good news, it actually works when i manually add the user to the group, but doesnt work when LDAP sync the member from our Active Directory security group ? what are we missing ?