- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 12:23 AM
Hello!
In servicenow there is a base table 'cmdb_ci_service' that 'cmdb_ci_service_business' and 'cmdb_ci_service_technical' inherit from.
Only 15 records out of 137 are visible with service classification = Technical Service, in the list view for Technical Service table (cmdb_ci_service_technical). The rest with the same classification are only visible in the cmdb_ci_service table list view. So you want to move all of these from cmdb_ci_service to cmdb_ci_service_technical so that they are all visible on cmdb_ci_service_technical.
My collegue said this could be fixed via a simple Fix Script that would reclassify all those that have 'service_classification' 'Business Service' and class 'cmdb_ci_service' to instead have class cmdb_ci_service_business while those that have 'Technical Service' and class cmdb_ci_service' to be reclassified as 'cmdb_ci_service_technical'.
Keep in mind, in the base table (cmdb_ci_service), there is the 'sys_class_name' field/column which contains ​​values 'cmdb_ci_service_technical' and 'cmdb_ci_service_business' that the fix script could use to reclassify the rows.
But my Fix Script just is not working as no rows have been updated, have I missed anything else to go through? So here is my Fix Script:
(function executeFixScript() {
var gr = new GlideRecord('cmdb_ci_service');
gr.addQuery('sys_class_name', 'cmdb_ci_service'); // Endast de som inte redan är klassificerade
gr.query();
var updatedCount = 0;
while (gr.next()) {
if (gr.service_classification == 'business_service') {
gr.sys_class_name = 'cmdb_ci_service_business';
gr.update();
updatedCount++;
} else if (gr.service_classification == 'technical_service') {
gr.sys_class_name = 'cmdb_ci_service_technical';
gr.update();
updatedCount++;
}
}
gs.print('Fix script klart. Uppdaterade poster: ' + updatedCount);
})();
Thankful for help and input!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 01:04 AM
hey, the script didn't work cause you are using business_service here:
gr.service_classification == 'business_service'
but checking the XML on my instance <service_classification>Business Service</service_classification>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 12:40 AM
Hi @ronro2
You can manually upgrade (reclassify) the CI class without using any scripts:
Navigate to the "cmdb_ci_service" table and filter the CI that you want to upgrade.
In the list view, double-click on the "class" field and select the appropriate child class.
Note: You can use Shift + Down Arrow to select multiple records and update them simultaneously.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 01:03 AM
@J Siva for some reason there is only one value for records when they're either "Technical Service" or "Business Service" even though I'm in the cmdb_ci_service base table:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 01:28 AM
@ronro2 As i mentioned earlier, go to cmdb_ci_service table and from the list view try to update the "Class" as technical service.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 01:04 AM
hey, the script didn't work cause you are using business_service here:
gr.service_classification == 'business_service'
but checking the XML on my instance <service_classification>Business Service</service_classification>