Tasks 'opened by' someone that reports to me.

BOC_CSA_ITSMGuy
Tera Contributor

I have a requirement that managers in assignment groups want/need to be able to see tasks that were 'opened by' someone on their team.   I can't seem to get the query right, could I get some assistance?   or pointed in a direction.  

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@BOC_CSA_ITSMGuy 

you can create dynamic filter and then use that in Opened By reference field

Create your own Dynamic Filters 

OR

you can create a left nav module and use URL arguments to call script include

see this

how to call script include in argument from module and link type is list of record  -> response from Ahmmed Ali

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@BOC_CSA_ITSMGuy 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sarthak Kashyap
Mega Sage

Hi @BOC_CSA_ITSMGuy ,

 

You can create a client callable script include and add below script 

var manager = gs.getUserID();

var groups = [];
var grp = new GlideRecord('sys_user_group');
grp.addQuery('manager', manager);
grp.query();
while (grp.next()) {
    gs.info("Here = " + grp.name);
    groups.push(grp.getUniqueValue());
}

var users = [];
if (groups.length > 0) {
    var mem = new GlideRecord('sys_user_grmember');
    mem.addQuery('group', 'IN', groups);
    mem.query();
    while (mem.next()) {
	gs.info("User - " + mem.user.getDisplayValue())
        users.push(mem.user.toString());
    }
}

if (users.length > 0) {
    var task = new GlideRecord('task');
    task.addQuery('opened_by', 'IN', users);
    task.query();
    while (task.next()) {
        gs.info('Task: ' + task.number + ' opened by ' + task.opened_by.getDisplayValue());
        return task.sys_id;
    }
}

 

After that navigated to All > System Definition > Dynamic Filter Option

Create new , give your table name, add that script include that you created.

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

BOC_CSA_ITSMGuy
Tera Contributor

Thanks for the replies, I haven't tried these suggestions yet,  was pulled away on another project but will get to it this week.  Thank you for your assistance thus far.