The CreatorCon Call for Content is officially open! Get started here.

Dynamic Filter(I am Manager Group)

avinash21
Mega Contributor

Hi All

I have to show the incidents which is assigned to groups to which the logged in user is Manager, I am using Dynamic Filters to achieve this.I have written the function in a BR as below

function IamManagerGroups()

{

      var mgr = gs.getUserID();

        var grMem = new GlideRecord('sys_user_group');

        grMem.addQuery('manager',mgr);

      grMem.query();

      var returnlist="[";

      while(grMem.next())

              {

                     

                      returnlist=returnlist+grMem.sys_id+", ";

                     

                      gs.addErrorMessage(returnlist);

              }

      returnlist=returnlist+"]";

     

      return returnlist;

}

and DYnamic Filter as below

find_real_file.png

1 ACCEPTED SOLUTION

Hi Avinash,



You can achieve this using a simple code in your function.




function IamManagerGroups()


{


var me=gs.getUserID();


var gr = new GlideRecord('sys_user_group');


gr.addQuery('manager',me);


gr.query();


var groups=[];


while(gr.next()){


groups.push(gr.sys_id.toString());


}


  return groups;


}




Thanks,


Jagarnath


View solution in original post

4 REPLIES 4

Ashutosh Munot1
Kilo Patron
Kilo Patron

hi Avinash,



You want to show incident of group manager group to logged in user if he is member of this group rite?


avinash21
Mega Contributor

Hi Ashutosh



Let Say I am manager for Group A,B,C . When I log in I should see all the INC assigned to these support group , I an trying this using Dynamic Filter, Its not working.


TIA


Hi Avinash,



You can achieve this using a simple code in your function.




function IamManagerGroups()


{


var me=gs.getUserID();


var gr = new GlideRecord('sys_user_group');


gr.addQuery('manager',me);


gr.query();


var groups=[];


while(gr.next()){


groups.push(gr.sys_id.toString());


}


  return groups;


}




Thanks,


Jagarnath


Ashutosh Munot1
Kilo Patron
Kilo Patron

try using before query business rule.



in which you can have and or condition and encoded query as well.