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

dynamic filter option on reference field

Rj27
Mega Guru

Hi All,

Can we define dynamic filter option on 'requested for' reference field as shown?
Can we use 'current' this way directly? Because the following script is not working at all.
Note: I am using this under default value related list with a reason to set default values when i click on lookup option. From reference qualifier i am returning something else and can't define the default values there.

find_real_file.png

 

find_real_file.png

38 REPLIES 38

@Rj27 

few corrections and please make these updated

1) remove gs.log from script include

2) in the reference script you need to select the script include which you created

3) make the script include client callable

4) don't keep script include name and function name same

5) update Script as: javascript: new global.getRequestedFor().getValue();

I have changed the function name.

Using the above changes it should work fine

Regards
Ankur

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

Hi Ankur,

Made the above changes but still not working.
Also, the script field on the dynamic filter option form says not to use javascript: .
I have changed the function name and script include name and made it client callable.

Now my script is (client callable) :

var getRequestedFor = Class.create();
getRequestedFor.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getReqFor: function() {

var query = '';
query = 'active=true^sys_domain=' + current.sys_domain;
return query.toString();
},

type: 'getRequestedFor'
});

 

 

and the script field on dynamic filter option page is :
new global.getRequestedFor().getReqFor();

Call like this:

Script:new global.GetRequestedFor().getRequestedFor();

Don't need to make client callable. It's working for me without clie.nt callable

This is weird. I am giving
new global.getRequestedFor().getReqFor(); but it's not working for me