
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2015 12:12 PM
On our record producer for Incidents we have a reference field where a user can choose from their closed incidents. It is using an advanced reference qualifier that is showing as javascript:getCallerClosedIncidents(). This was not working and was showing users all incidents in the system. I went to script includes and could not find getCallerClosedIncidents. I'm trying to recreate it but I'm not 100% sure how to write the script so the reference only pulls the current callers closed incidents. Anybody have something similar?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2019 11:00 PM
If you want to do it base on the caller field on the form you cannot use is dynamic me as that will be the logged in user. You will have to do it with an advanced reference qualifier.
javascript:'caller_id=' + current.variables.caller_id +'^stateIN6,7'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2015 12:23 PM
You could do a Script Include like this:
function getCallerClosedIncidents(){
var answer = '';
var incident = new GlideRecord('incident');
incident.addQuery('caller_id', gs.getUserID());
incident.addQuery('active', false);
incident.query();
while(incident.next()){
var incList = (incList == '')? incList.sys_id : ',' + incList.sys_id;
answer = 'sys_idIN' + incList;
}
return answer;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2015 12:24 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2015 12:46 PM
This is returning no incidents when I try my account. If I'm in as my admin it returns all incidents. Also we have a caller_id (displayed as open on behalf of) which is a reference to the sys_user table. I would like to use this filed so if they change the caller to someone else it will bring up that persons incidents. I tried changing gs.getUserID() to current.caller_id but that returns all incidents as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2015 01:01 PM
This is strange as soon as I closed out an incident created with my admin account and close it I get not results leaving the script as you gave it to me.