Change Request API
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2025 11:24 PM
Hey guys , i am trying to retrieve the impacted services info for the change request. I tried to pull data from task_ci and task_cmdb_ci_service but the results don't seem to be matching with what I see in the ui .
Any suggestions pls?
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2025 10:57 PM
Hi @jerinjose93 ,
try with below way
1. Create Scripted rest API's
2. Create resource with HTTP method Get
3. in script try something like this
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var changeId = request.queryParams.change_id;
var cu = new ChangeUtils();
cu.refreshImpactedServices(changeId);
var impacted = [];
var affected= []
var gr = new GlideRecord('task_cmdb_ci_service');
gr.addQuery('task', changeId);
gr.query();
while (gr.next()) {
impacted.push({
"service_name": gr.cmdb_ci_service.getDisplayValue(),
"service_id": gr.getValue('cmdb_ci_service')
});
}
var gr = new GlideRecord('task_ci');
gr.addQuery('task', changeId);
gr.query();
while (gr.next()) {
affected.push({
"affected_name": gr.ci_item.getDisplayValue(),
"service_id": gr.getValue('ci_item')
});
}
return {
"impacted_services": impacted,
"affected_name": affected
};
})(request, response);
4. save the record and click on Explore REST API
5. Test with the change record
6. JSON response will have
{
"result": {
"impacted_services": [
{
"service_name": "Email",
"service_id": "27d32778c0a8000b00db970eeaa60f16"
}
],
"affected_name": [
{
"affected_name": "*BUD-IBM",
"service_id": "53fdbc8437201000deeabfc8bcbe5d10"
}
]
}
}
If this information proves useful, kindly mark it as helpful or accepted solution.
Thanks,
BK
If this information proves useful, kindly mark it as helpful or accepted solution.
Thanks,
BK
Thanks,
BK
