- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 01:26 PM
Good morning,
I added a reference field to our incident form, that references the TAGs table (label), it's configured as a drop down with --None-- option so users can "Tag" the expected cause of an incident while closing the case.
I want to show specific Tags (that I have created in the Tags table as global tags), depending on what assignment group the incident is assigned too (assignment_group).
For the life of me I can't figure out how to make this work given there are multiple assignment groups and only a subset of Tags I want to show for each, while some tags will be visible for more than one assignment group.
Options:
SNAG - IT User Services Team
SNAG - IT Infrastructure Team
SNAG - IT Integrations Team
Tag | Visible to User Services | Visible to Infrastructure | Visible to Integrations |
Data Defect | n | n | y |
User Training | y | y | y |
Network Issue | y | y | y |
Hardware Issue | y | n | n |
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 05:15 AM
Since this relationship is not defined in a table anywhere, you'll have to manually build the list in a Script Include and return only the desired records. So your Reference qualifier on your tag field would look something like this:
javascript: new IncidentUtils().getTags(current.assignment_group)
where : is actually the colon character, IncidentUtils is the name of a Client callable Script Include, and getTags is the name of a function in that SI.
If you want the reference field to appear as a drop-down list you'll also need to add this to the Attributes field in the Advanced Dictionary Entry view:
ref_auto_completer=AJAXReferenceChoice,ref_qual_elements=assignment_group
The Script Include would look like this:
var IncidentUtils = Class.create();
IncidentUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getTags: function(ag) {
var arr = [];
var tags = new GlideRecord('label');
tags.query();
while (tags.next()) {
if (ag == '019ad92ec7230010393d265c95c260dd') { //sys_id of AG1
if (tags.name == 'User Training' || tags.name == 'Network Issue' || tags.name == 'Hardware Issue') {
arr.push(tags.sys_id.toString());
}
}
if (ag == '72910dd8779050108a370870a81061a9') { //sys_id of AG2
if (tags.name == 'User Training' || tags.name == 'Network Issue') {
arr.push(tags.sys_id.toString());
}
}
if (ag == '0a52d3dcd7011200f2d224837e6103f2') { //sys_id of AG3
if (tags.name == 'Data Defect' || tags.name == 'User Training' || tags.name == 'Network Issue') {
arr.push(tags.sys_id.toString());
}
}
}
return 'sys_idIN' + arr.join(',');
},
type: 'IncidentUtils'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 05:15 AM
Since this relationship is not defined in a table anywhere, you'll have to manually build the list in a Script Include and return only the desired records. So your Reference qualifier on your tag field would look something like this:
javascript: new IncidentUtils().getTags(current.assignment_group)
where : is actually the colon character, IncidentUtils is the name of a Client callable Script Include, and getTags is the name of a function in that SI.
If you want the reference field to appear as a drop-down list you'll also need to add this to the Attributes field in the Advanced Dictionary Entry view:
ref_auto_completer=AJAXReferenceChoice,ref_qual_elements=assignment_group
The Script Include would look like this:
var IncidentUtils = Class.create();
IncidentUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getTags: function(ag) {
var arr = [];
var tags = new GlideRecord('label');
tags.query();
while (tags.next()) {
if (ag == '019ad92ec7230010393d265c95c260dd') { //sys_id of AG1
if (tags.name == 'User Training' || tags.name == 'Network Issue' || tags.name == 'Hardware Issue') {
arr.push(tags.sys_id.toString());
}
}
if (ag == '72910dd8779050108a370870a81061a9') { //sys_id of AG2
if (tags.name == 'User Training' || tags.name == 'Network Issue') {
arr.push(tags.sys_id.toString());
}
}
if (ag == '0a52d3dcd7011200f2d224837e6103f2') { //sys_id of AG3
if (tags.name == 'Data Defect' || tags.name == 'User Training' || tags.name == 'Network Issue') {
arr.push(tags.sys_id.toString());
}
}
}
return 'sys_idIN' + arr.join(',');
},
type: 'IncidentUtils'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2024 02:04 AM
In ServiceNow incident form we have reference field business services('cmdb_ci_service'), whenver i selected assignment group 'SAP', it should filter only SAP services in the business services field