The CreatorCon Call for Content is officially open! Get started here.

cmdb_ci_service

Snehal
Tera Expert

Hi Team
I have one script include is applied in the service field of change request where some filters are applied through the script on the cmdb_ci_service on table and i want to and one more condition where i want add the Screenshot 2025-05-19 at 5.27.17 PM.pngfilter the to visible only operational services so attaching the screenshot and also i was checking the exact filter on table i could not able to replicate please help me here

6 REPLIES 6

Hi @Snehal ,

If you want to add your new query in addition to the existing query, write 

conditionGR.addEncodedQuery('operational_status=1')

Write it below the other encoded query.

 

Regards,

Ehab 

Community Alums
Not applicable

Hi @Snehal  ,

Typically:

  • The field operational_status is used.

  • The value for Operational is usually 1 (Operational), depending on your instance.

You can verify this by looking at the dictionary for cmdb_ci_service.operational_status.

 

updated script incldue 

serviceConditions: function() {
  var serviceSys_ids = [];
  var conditionsGr = new GlideRecord('cmdb_ci_service');

  // Add operational_status filter (value 1 = Operational)
  conditionsGr.addEncodedQuery(
    'install_statusNOT IN100,7^' + 
    'ref_service_offering.service_classification=Application Service^' + 
    'ORref_service_offering.service_classification=Business Service^' +
    'NQsys_class_name=cmdb_ci_query_based_service^' + 
    'ORsys_class_name=cmdb_ci_service_business^' + 
    'ORsys_class_name=cmdb_ci_service_discovered^' + 
    'ORsys_class_name=cmdb_ci_service_technical^' +
    '^operational_status=1'
  );

  conditionsGr.query();
  while (conditionsGr.next()) {
    serviceSys_ids.push(conditionsGr.sys_id.toString());
  }

  return 'sys_idIN' + serviceSys_ids;
}

 

Testing 

 

  • Go to the cmdb_ci_service.list

  • Apply the same addEncodedQuery() in a filter and test it out in the list view.

  • Ensure the operational_status=1 is working and bringing expected results.