Calling Script Include from Module Filter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 06:10 AM
Hi All,
I am trying to call a script include from module filter using -
javascript:AZChangehelper.getCompanyID()
Script include is client callable and function is returning sys_id of some group. Is it mandatory to have same function name as script include or is there any other way to call script include from module filter.
tried these many options-
javascript:AZChangehelper.getCompanyID()
javascript:gs.inlcude('AZChangehelper'); new AZChangehelper.getCompanyID()
javascript:getCompanyID()
Nothing is working.
Thanks,
ARS

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 06:17 AM
I would use the is (dynamic) option and then create a scripted filter there.
Using Filters and Breadcrumbs - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 07:01 AM
Hi Brad,
I tried creating Dynamic filter by taking reference from existing "One of my functional groups". But still I am getting empty value in my filter. My filter is on change_request table and I have a field Cab Unit which is a reference to Group table.
In my filter I am doing -
Cab Unit is (dynamic) getCompany, where getCompany is my dynamic filter.
PFA image for dynamic filter definitiion.
Filter image - Cab Unit is empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2016 12:37 AM
I tried creating scripted filter by having same function name as script include(client callable). Even the first line of script include is not getting called from the filter.
In System logs, there are some warnings which are generated:
org.mozilla.javascript.EcmaError: "__ref__" is not defined.
Caused by error in <refname> at line 1
==> 1: __ref__.getReferenceKey()
------------------------------------------------------------------------------------
org.mozilla.javascript.EcmaError: "__ref__" is not defined.
Caused by error in <refname> at line -1
Any help would be appreciated.
Thanks,
ARS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2016 01:40 AM
Can you share the script include you have written and the scripted filter ?
Thanks,
Mihir