Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Since these are (unfortunately) managed in the SN schema, they are generally done manually. Changes can be also effected w/ this script:

function load(group,users) {
  // get group record
  var g = new GlideRecord('sys_user_group');
  g.addQuery('name', 'CONTAINS', group);
  g.query(); g.next();
  gs.print('group is: ' + g.name);

  // get user sys_ids
  var sysids = '';
  var a = users.split(',');
  for(i=0;i<a.length;i++) {
    var u = new GlideRecord('sys_user');
    u.addQuery('user_name',a[i]);
    u.query(); u.next();
    sysids+=u.sys_id + ',';
  }
  gs.print('sysids are: ' + sysids);

  // update the group record
  g.u_team_leads = sysids;
  g.update();
}

//
// example loads -- beware greedy matching.
//load("Berkeley", "cam48,djy6,hzl3,ngh6,csw3,dz65");
//load("Branford", "jlf8,kc572,ss2372,tp277,am993,csw3,dz65");
//load("Calhoun", "anr2,bpb28,dkb23,ss2374,aef3,csw3,dz65");
//load("Davenport", "ezp2,gal7,lew36,ss2476,xz244,csw3,dz65");
//load("Ezra", "acm73,dl479,dwh5,dfp22,yk347,csw3,dz65");
//load("Grad 1", "ajz7,gm74,hz235,mh696,ts484,ncw8,csw3,dz65");
//load("Grad 2", "aao23,deb29,icc7,jgk27,kk495,nii4,csw3,dz65");
//load("Hardware", "am993,aef3,ncw8,jmq23,mya2,deg38,csw3,dz65");
//load("Jonathan", "cmv29,jsr24,sgy2,sp576,csw3,dz65");
//load("Morse", "jp697,pft5,rwc39,yz343,zpx2,csw3,dz65");
//load("Old Campus 1", "aes86,cw486,mme2,mrc27,ta266,csw3,dz65");
//load("Old Campus 2", "lkh9,ncm28,qc32,sna23,csw3,dz65");
//load("Pierson", "ase29,jfp38,ml775,rck6,csw3,dz65");
//load("Saybrook", "hzy2,mdj4,rc527,zkm4,csw3,dz65");
//load("Silliman", "hd96,jmo2,mnq2,pwc27,csw3,dz65");
//load("Timothy", "cxz2,efs8,msl25,deg38,csw3,dz65");
//load("Trumbull", "cl638,hko3,jk787,jzr4,tw334,csw3,dz65");

Dump group membership

 var g = new GlideRecord('sys_user_grmember');
  g.addQuery('name', 'CTS STC Cluster Zone 1');
  g.query();
  var n=0;
  while (g.next()) {
     if (n == 0 ) {
       gs.print('members are: ');
     }
     gs.print(g.user.user_name + ';');
  }
  • No labels