- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2020 09:38 AM
Hi All,
I am trying to filter the incidents by logged in user location, I am trying to use script include and a dynamic filter to achieve this. But i am unable to filter the logged incidents with currenty logged in user location. PFB the details-
Script Include
var getMyUserInfo = Class.create();
var answer = '';
myConditionCheck.prototype =
{
initialize: function()
{
},
myRegion : function()
{
var user = new GlideRecord('sys_user');
user.addQuery('sys_id',gs.getUserID());
user.query();
// if (user.get(gs.getUserID())
//if(user.getUserID())
if(user.next())
{
//var location = gs.getUser().getLocation();
//return user.location;
answer = user.location;
return answer;
}
return;
},
type: 'myConditionCheck'
};
Dynamic Filter
Please help me !!
Thanks,
Kumar Nandan
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2020 10:36 AM
Hi,
The reason I have asked instance URL so that I can fix it directly in your instance. Please check your instance. I have created a new script include and it is working fine now.
var getMyUserInfo = Class.create();
getMyUserInfo.prototype = {
initialize: function() {},
myRegion: function() {
var answer;
var user = new GlideRecord('sys_user');
user.addQuery('sys_id', gs.getUserID());
user.query();
// if (user.get(gs.getUserID())
//if(user.getUserID())
if (user.next()) {
//var location = gs.getUser().getLocation();
//return user.location;
answer = user.location;
return answer;
}
},
type: 'getMyUserInfo'
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2020 10:09 AM
Hi Kumar - Do you have this setup in personal dev instance URL? If yes, please share the link...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2020 10:27 AM
Hi Pradeep,
Yes I am working on PDI. I do not understand what you will do with just link without credentials. For reference I have attached XML of the record too. However PFB the link
https://dev82723.service-now.com/nav_to.do?uri=sys_script_include.do?sys_id=95aa639bdb9f101061122706ca96192f
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2020 10:36 AM
Hi,
The reason I have asked instance URL so that I can fix it directly in your instance. Please check your instance. I have created a new script include and it is working fine now.
var getMyUserInfo = Class.create();
getMyUserInfo.prototype = {
initialize: function() {},
myRegion: function() {
var answer;
var user = new GlideRecord('sys_user');
user.addQuery('sys_id', gs.getUserID());
user.query();
// if (user.get(gs.getUserID())
//if(user.getUserID())
if (user.next()) {
//var location = gs.getUser().getLocation();
//return user.location;
answer = user.location;
return answer;
}
},
type: 'getMyUserInfo'
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2020 10:57 AM
Let me know if that answered your question. If so, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.