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

Hi @Brad Bowman  ,

 

Precisely below is the screenshot of an INC form -

BijayKumarSha_0-1725958884878.png

 

When I'm checking 'configure dictionary' of the reference filed, I see that there is reference qualifier has been mentioned on the task table which I've provided the screenshot in my question. 

Also, regarding the Dictionary Override, below is the screenshot for the same -

BijayKumarSha_1-1725959105252.png

 

Let me know what more needs to be added in the reference qualifier, so that in the he reference field should pick from 'cmdb_ci_vm_instance' table having 'install_status' != 16 (this is for Deactivated). It should populate only active VM instances keeping existing functionality as it is.

 

Thanks for confirming that you do not have an Override reference qualifier on the incident table.  If your task table reference qualifier is otherwise working, try to not impact that by just adding to the end of it something like this:

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

so you're just taking the existing filter and adding sys_idNOTIN then a list of inactive VMs that you can get from another SI call.  This isn't the best approach as it involves 2 server calls for the qualifier, but you can try to combine them later if there's a performance issue.  You can use a new function in the same SI if you want.  It just needs to execute a GlideRecord on the vm_instance table and return a joined array of records that are deactivated, something like this:

var vmArr = [];
var records = new GlideRecord('cmdb_ci_vm_instance');
records.addQuery('install_status', '16');
records.query();
while (records.next()) {
	vmArr.push(records.sys_id.toString());
}
return vmArr.join(',');

 

Hi @Brad Bowman  ,

I tried to create a Script Include that you've mentioned bt getting below error. Can you please look into it -

BijayKumarSha_0-1726046639768.png

 

The SI doesn't need to be Client callable for a reference qualifier, but that's not hurting anything.  Line 4 should just be

getVM: function() {

as () are not used in function name declarations, and you are not passing in an argument from the calling reference qualifier in this case.

Hi @Brad Bowman  ,

I tried, but unable to select anything in the configuration item reference field on the INC form. Below is the screenshot - 

BijayKumarSha_0-1726065400695.png

 

My requirement is to it should not include the VMs where install_status = Deactivated (16). And it'll show other install status VMs