
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2018 06:40 AM
I'm trying to create a Dynamic filter using script include or also Business Rules, how ever, I've been trying and when i tried to recognize how to do:
- Script include / Application: Global / Accessible from: All application scopes
- Dynamic Filter / script: javascript: new <includename>.<function name>(); / Reference Script: Script Include: <includename>
Script Include
var appLogin = Class.create();
appLogin.prototype = Object.extendsObject(AbstractAjaxProcessor, {
filterMe: function(){
var vuserid = gs.getUserID();
vReturn = "";
vIsTrue = this.isTrue();
if (vIsTrue== false)
{
vReturn = vuserid;}
else
{
vReturn = this.GetMyBoss();
}
return vReturn;
},
isTrue: function(){
var vuserid = gs.getUserID();
var ObjUser = new GlideRecord('sys_user');
ObjUser.get(vuserid);
var vistrue= ObjUser.u_istrue;
return vistrue;
},
GetMyBoss: function(){
var vuserid = gs.getUserID();
var ObjUser = new GlideRecord('sys_user');
ObjUser.get(vuserid);
var vmyboss= ObjUser.u_myboss;
return vmyboss;
},
type: 'appLogin'
});
Dynamic FIlter Options
- new x_appLogin().filterMe()
- org.mozilla.javascript.EcmaError: "x_appLogin" is not defined. Caused by error in <refname> at line 1==> 1: javascript: new x_appLogin().filterMe();
- new x_appLogin.filterMe();
- org.mozilla.javascript.EcmaError: "x_appLogin" is not defined. Caused by error in Phase 2 Jelly: file:/glide/nodes/xxxxxxxxxxxxxxxx004_16033/webapps/glide/itil/WEB-INF/ui.jtemplates/doctype/template_bar.xml.2 at line 1==> 1: new x_appLogin().filterMe();
- new appLogin.filterMe();
- org.mozilla.javascript.EcmaError: undefined is not a function. Caused by error in <refname> at line 1 ==> 1: javascript: new appLogin.filterMe();
- gs.include('appLogin'); filterMe(); OR javascript:gs.include('appLogin'); filterMe();
- org.mozilla.javascript.EcmaError: "filterMe" is not defined. Caused by error in Phase 2 Jelly: file:/glide/nodes//4_16033/webapps/glide/itil/WEB-INF/ui.jtemplates/doctype/template_bar.xml.2 at line 1==> 1: gs.include('appLogin'); filterMe();
- applogin.filterMe();
- org.mozilla.javascript.EcmaError: "applogin" is not defined. Caused by error in <refname> at line 1==> 1: applogin.filterMe();
- javascript:applogin.filterMe();
- org.mozilla.javascript.EcmaError: "applogin" is not defined. Caused by error in Phase 2 Jelly: file:/glide/nodes16033/webapps/glide/itil/WEB-INF/ui.jtemplates/doctype/template_bar.xml.2 at line 1==> 1: javascript:applogin.filterMe();
BUT
Anything happens on my filter,
What am i making for isn't work?
Solved! Go to Solution.
- 9,071 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2018 12:41 PM
Can you just try without javascript in your dynamic filter's script field (in your screen shot you are using javascript keyword), like,
new appLogin().filterMe();
OR
gs.include('appLogin');new appLogin().filterMe();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2018 06:59 AM
If you are in scoped App and trying to access a script include from global scope, you will have to provide the namespace
new global.scriptIncludeName() or new x_yourAppNameSpace.scriptIncludeName()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2018 10:26 AM
Hi Tiago,
See below links, they are helpful:
Dynamic Reference Qualifier - Script Include InactiveUsers
Re: Dynamic Reference Qualifiers
Regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 10:25 AM
HI Guys,
It's working when:
function filterMe(){
return "xxxxxxxxxxxxxxx";
}
and on Dynamic Filter
gs.include("appLogin"); filterMe();
But i discovered, isn't my real problem, i'm looking for some conversion data problem on Glide Query
var vsys_id = gs.getUserID();
var objU= new GlideRecord('sys_user');
objU.addQuery('sys_id', vsys_id );
objU.query();
objU.next();
Thank You

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 11:23 AM
Please check if these changes helps,
1. if (vIsTrue == 'false') //Let's put false keyword under quotes
2. var vmyboss= ObjUser.u_myboss.toString(); //let's have toString() while returning the myBoss value in GetMyBoss function

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 11:33 AM