- 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 08:06 PM
HI Pradeep,
Thank you so much. Yes you did it. 🙂 🙂
Regards,
Kumar Nandan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 08:21 PM
You are very welcome.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 10:34 AM
What does 'gs.getUser().getLocation()' return?
Have you tried using that directly in your arguments like 'location=javascript:gs.getUser().getLocation()' ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 10:40 AM
Also 'Client Callable' should be checked to true.