Advance Reference Qualifier on Configuration Item variable on Incident Form

Bijay Kumar Sha
Giga Guru

Hi,

I've a variable on the INC form 'Configuration item' (cmdb_ci). When I tried to put a VDI name (virtual machine instance) and I see it's showing 3 entries. When I checked the name in cmdb_ci table, I see that out there are 3 records showing with the same name and out of which 1 is in active state and other are inactive. 

Then I see the existing reference qualifier configured in the INC form which is as below -

BijayKumarSha_0-1725895704086.png


Hence, my requirement is to add a new condition which says, the reference field should pick from 'cmdb_ci_vm_instance' table having 'install_status' != 16 (this is for Deactivated).

 

Can anyone please help me to get this done?

14 REPLIES 14

Brad Bowman
Kilo Patron
Kilo Patron

First, just to confirm, are you certain this is the reference qualifier fo Configuration item on the incident form/table?  What you pictured is the qualifier for the task table, which will be in effect for all extended tables (like incident) unless a Dictionary Override has been added.  Do you have a record on the Dictionary Override related list for incident that is overriding the reference qualifier?

BradBowman_0-1725899113992.png

If not you want to create one, unless you want this new criteria in place anywhere system-wide where a CI can be selected.

If what you have pictured is indeed the qualifier for incident, it looks like what you'll need to do - either on the cmdb_ci reference qualifier or an override - is look at the Script Include named OpsStatusFilter, which is either classless, or has a poorly-named function 'by' within it.  In the function that is currently doing the rest of the work to filter your list currently, you'll have to incorporate the new criteria, which will depend on the existing script, so post that if you've made it this far but are still having trouble.

Hi @Brad Bowman  ,

Could you please explain me what is the join() function in that reference qualifier meant for ? or is that a function in the script includes ?

 

.join usually means take an array and turn it into a string, separated by the character inside the ().  You can work with an array without using .join and it defaults to comma-separated, so maybe by using .join() the comma is also implied, or else it's not doing anything if the function is already returning a comma-separated list of operational_status values.

 

Since you want to remove some vm records with a certain install_status, it seems like you may need to just add to the end of the existing qualifier something like:

+ '^sys_idNOTIN' + new incUtils().getVM()

where the getVM function in a SI named incUtils (or whatever you want) does a GlideRecord on the vm_instance table and returns a joined array of records that are deactivated.

 

@Brad Bowman   , okay got it , I was literally confused with the naming over there.