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

This means the 2 server calls, along with the number of records on the cmdb_ci and/or cmdb_ci_vm_instance table are likely causing a performance issue.  What does your reference qualifier look like now? Also post the entire OpsStatusFilter script using the insert code </> icon so I can see the best way to combine the new script with this one.

Hi @Brad Bowman  ,

Below is the updated Advance reference qualifier -

 

javascript&colon;['incident', 'problem', 'incident_task', 'problem_task', 'u_service_request'].indexOf(current.sys_class_name + '') == -1? '' : 'sys_class_name!=cmdb_ci_application_software^sys_class_name!=cmdb_ci_business_app^sys_class_name!=cmdb_ci_business_capability^operational_statusNOT IN' + new OpsStatusFilter('cmdb_ci').by('CreateTask').join() + '^sys_idNOTIN' + new incUtils().getVM()

This should work better with the number of records you must have on these tables, and without the second server call.

javascript&colon;['incident', 'problem', 'incident_task', 'problem_task', 'u_service_request'].indexOf(current.sys_class_name + '') == -1? '' : 'sys_class_name!=cmdb_ci_application_software^sys_class_name!=cmdb_ci_business_app^sys_class_name!=cmdb_ci_business_capability^operational_statusNOT IN' + new OpsStatusFilter('cmdb_ci').by('CreateTask').join() + '^NQinstall_status!=16^sys_class_name=cmdb_ci_vm_instance';

Since the vm_instance records also exist on the cmdb_ci table with the same install_status, this is just adding to the original qualifier an overall OR (the equivalent of parenthesis around a complex condition with ANDs and ORs) install_status!=16 AND class is vm_instance.

 

Hi @Brad Bowman  ,

When I tried to put the script you mentioned in the advance reference qualifier and hit the save. Then automatically it gets updated to Simple Reference qualifier and updated to different conditions. PFA the screenshot as below -

BijayKumarSha_0-1726137244090.png

 

Then I tried below script - 

javascript&colon;['incident', 'problem', 'incident_task', 'problem_task', 'u_service_request'].indexOf(current.sys_class_name + '') == -1? '' : 'sys_class_name!=cmdb_ci_application_software^sys_class_name!=cmdb_ci_business_app^sys_class_name!=cmdb_ci_business_capability^operational_statusNOT IN' + new OpsStatusFilter('cmdb_ci').by('CreateTask').join() + '^NQinstall_status!=16^sys_class_name=cmdb_ci_vm_instance';

 

But I see nothing got changed. It's showing as it was. 😞

 

I don't understand.  If you take your original reference qualifier and just add to the end

+ '^NQinstall_status!=16^sys_class_name=cmdb_ci_vm_instance';

It should not revert to Simple once it is saved.  Are you saying the reference qualifier or the list of records are showing as it was?