The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to filter reference qualifier with a script include and filter by content of group's name?

iDevilsdocry
Mega Contributor

Hello,

I'm trying to filter a list of groups that a reference field shows using this as my advanced reference qualifier.

javascript:'sys_idIN' +getMyGroups()+^nameNOT LIKEApproval

Problem with this is that, only the 'nameNOT LIKEApproval' is working. The first half doesn't work unless I remove second half of that condition.

I'm new with reference qualifiers so I have no clue what I have to do. I am assuming I might have to write script include but what would that looks like?

1 ACCEPTED SOLUTION

iDevilsdocry
Mega Contributor

This is solved using the Reference qualifier below:

javascript:'sys_idIN'+getMyGroups()+'^nameNOT LIKEApproval'

compare to original question

javascript:'sys_idIN' +getMyGroups()+^nameNOT LIKEApproval

Just had to add quotes around the second part of it and removed a space in the first part.

View solution in original post

4 REPLIES 4

Elijah Aromola
Mega Sage

Change "getMyGroups()" to gs.getUser().getMyGroups().

 

Please mark this as correct/helpful if this resolved your issue!

Mike Patel
Tera Sage

use gs.getUser().getMyGroups(); instead of getMyGroups();

Peter de Bock1
Mega Guru

Hi there,

Below an example of a reference qualifier filter using a script include :

Reference Qualifier:  javascript:new refQualifiers().getGroups(current);

Script include: refQualifiers

Note: Client Callable can be left unchecked as it is a server side function

Below script return an Encoded query. Below is a result of sysid's. Be aware that this can be any type of Encoded query.

var refQualifiers = Class.create();
refQualifiers.prototype = {
    initialize: function() {
    },
	
	getGroups:function(current) {
		// Your code using scripting
		
		sysids = '....,....';
		
		//Return an Encoded Query
		return 'sys_idIN' + sysids;
	},
	
    type: 'refQualifiers'
};

 

regards, Peter

Please mark this as correct or helpful (in case it is :-)), so other people can find it too

iDevilsdocry
Mega Contributor

This is solved using the Reference qualifier below:

javascript:'sys_idIN'+getMyGroups()+'^nameNOT LIKEApproval'

compare to original question

javascript:'sys_idIN' +getMyGroups()+^nameNOT LIKEApproval

Just had to add quotes around the second part of it and removed a space in the first part.