- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2014 05:22 AM
I want to create a link from left hand pane called My Assets which will show All Assets with the same location as the current logged in user.
I know from Dublin you can download and install something called Simple Separation but we are on Calgary so this won't work for us.
I think I need a business rule like the one for getMyApprovals, but, i'm struggling with the code as I only know a little Javascript
Has anyone been able to write anything like that or can help?
Thank you in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2014 04:28 AM
I managed to get this working by using the following script include:
function getlocationList() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
var answer = new Array();
var i = 0;
answer[i++] = new String(user);
var g = new GlideRecord("cmn_location");
g.addQuery("country", user.location.country);
g.query();
while( g.next())
answer[i++] = new String(g.sys_id);
return answer;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2014 04:01 AM
I think its the while(gr.next()) query.
Won't it bring back a list anyway as the query is run from the filter? do I need the while?
The sys_id that is brought back is the sys_id of a location and not an asset record? I need it just put the user.location.country into the filter don't I?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2014 04:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2014 07:15 AM
I see Santosh has just replied,
See if that works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2014 07:16 AM
seems a bit harsh - not meant to be
If that does not work we may need more info
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2014 04:28 AM
I managed to get this working by using the following script include:
function getlocationList() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
var answer = new Array();
var i = 0;
answer[i++] = new String(user);
var g = new GlideRecord("cmn_location");
g.addQuery("country", user.location.country);
g.query();
while( g.next())
answer[i++] = new String(g.sys_id);
return answer;
}