Referance Qualifier

Prem96
Tera Contributor

Based on selected server i need populate Ip_address in CIIP Field 

For this CIIP field I selected cmdb_ci_ip_address table 

in this table cmdb_ci is a server name field so that so i write 

Referance Qualifier :javascript:'cmdb_ci'=current.variables.server

Catalog item 

please help me 

5 REPLIES 5

Soni Tushar
Tera Guru

Hey @Prem96 

Try with this script: 

// Get the selected server from the current record
var selectedServer = current.variables.server;

// Create a GlideRecord query to filter IP addresses based on the selected server
var gr = new GlideRecord('cmdb_ci_ip_address');
gr.addQuery('cmdb_ci', selectedServer); // cmdb_ci is the server name field
gr.query();

// Build a query string for the reference qualifier
var query = 'sys_idIN';
var first = true;

// Append each sys_id to the query string
while (gr.next()) {
if (!first) {
query += ',';
}
query += gr.sys_id;
first = false;
}

// Return the query string
answer = query;

Hi Thanks for Your response. But Its Not working 

Brad Bowman
Kilo Patron
Kilo Patron

The cmdb_ci_ip_address does not contain a field named cmdb_ci, so you have to get there from the NIC.  You should be able to dot-walk in a reference qualifier

BradBowman_0-1721925265444.png

 

Prem96
Tera Contributor

Prem96_0-1721927499352.pngPrem96_1-1721927507716.png

Prem96_2-1721927519100.png

For that i write a script include and Reference Qualifier

Can you please help me.