- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2022 12:25 AM
If a special service is selected I want to see only items that are related to that service so I made ref qual but it's not working.
Script Include
name: SAP_CI
Script:
var SAP_CI = Class.create();
SAP_CI.prototype = {
initialize: function() {},
get_CI: function(service) {
var ci = new GlideRecord('cmdb_ci');
gs.log("I am workin", "Filipp");
if (service == '3d2f748207381510b605ff208c1ed0c3') {
gs.log("I am workin", script_includee);
ci.addEncodedQuery('u_sap=true');
ci.query();
} else {
ci.query();
}
answer = [];
while (ci.next()) {
answer.push(ci.getValue('sys_id'));
}
return 'sys_idIN' + answer;
},
type: 'SAP_CI'
};
Ref qual: javascript: new SAP_CI().get_CI(current.business_service);
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2022 02:32 AM
The reason was that I made changes in the task table not in dictionary override that's relate to incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2022 12:31 AM
Hi Filipp,
Can you please try "return 'sys_idIN' + answer.toString()" instead of "return 'sys_idIN' + answer";
Please mark correct if helpful.
Regards,
Vaibhav Dane

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2022 12:34 AM
Hi,
Try changing this
answer.push(ci.getValue('sys_id'));
}
return 'sys_idIN' + answer;
TO
answer.push(ci.sys_id.toString());
}
return 'sys_idIN' + answer;
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2022 12:39 AM
Hi,
update as this and no script include would be required
javascript: var query = ''; if(current.business_service.toString() == '3d2f748207381510b605ff208c1ed0c3') query = 'u_sap=true'; query;
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 05:18 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader