dynamic filter option on reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2020 10:06 PM
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.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 02:42 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 02:54 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 02:58 AM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 03:00 AM
Call like this:
Script:new global.GetRequestedFor().getRequestedFor();
Don't need to make client callable. It's working for me without clie.nt callable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 03:12 AM
This is weird. I am giving
new global.getRequestedFor().getReqFor(); but it's not working for me