Help with filter: Updated by != member of Assignment Group

JP-ODU
Tera Guru

I'm having a hard time with what I expected to be a straightforward filter: the request is to list only those Incidents that have been last updated by a user who is not a member of the incident's assignment group.

The first part is easy: Updated by | is not

The challenge I'm having a hard time wrapping my head around is how to correctly express the "member of the incident assignment group" in the filter. Any ideas?

Thanks!

11 REPLIES 11

asifnoor
Kilo Patron

Hi,

I think you can try like this.

updated_by is NOT and then mention something like this in the text field

javascript:gs.getUser().isMemberOf(" Application Development");

Mark the comment as a correct answer and helpful if this helps.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So basically you want to show incident to User A if he/she is the updated by user for the ticket and when he/she is not member of that group assigned to incident?

what if the user has updated by as his/her name but a member of all the incidents? what to show? -> do you want to show blank incident table i.e. return no records

I have assumed this in below script that return no records when he/she is member of group

use below query in query business rule;

var isMember = gs.getUser().isMemberOf(current.assignment_group);

var encodedQuery = 'sys_updated_by=' + gs.getUserName();

if(!isMember){

current.addEncodedQuery(encodedQuery);

}

else{

// return no records

var sys_id = -1;
current.addQuery('sys_id',sys_id);

}

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Uzzawal Agrawa1
Giga Contributor

Did you get any solution for this query, please help with the query I have similar requirement

Hi

To address a second requirement, I would suggest creating a new Dynamic Filter (System Definition > Dynamic Filter Options) with a referenced client-callable script (Script Include) which provides a list of users that are not members of the specified group.

You may check an example here

 

 

Hope it helps