Is it possible to have two reference qualifier applied on the same field?

tyagisu
Mega Expert

Hi,

We have 2 reference qualifiers for Configuration Item field, both of them works fine individually. When I combine those 2 together in advanced qualifier script, then only one of them works. I noticed that the later one always overrides the former one. These 2 ref quals are different from each other. 

First ref qual:

javascript: var refQual=''; refQual;'install_statusNOT IN12,15,7,14^sys_class_name=cmdb_ci_aix_server^ORsys_class_name=cmdb_ci_computer;

Second one looks like this:

javascript:if(!(gs.getUser().isMemberOf("ABC"))){"^sys_id!=000000000000000000";}

 

Any suggestion would be appreciated!

 

Thanks in Advance,

Su

1 ACCEPTED SOLUTION

Cody Smith _ Cl
Tera Guru

You can use a large Script. (if the script gets too large you can call a script include to return the query instead)

 

javascript:
var refQual = 'install_statusNOT IN12,15,7,14^sys_class_name=cmdb_ci_aix_server^ORsys_class_name=cmdb_ci_computer';

if (!(gs.getUser().isMemberOf("ABC"))) {
  refQual += "^sys_id!=000000000000000000";
}

refQual;

 

If my answer was helpful, or solved your issue, please mark it as Helpful / Correct.
Thank you,
Cody Smith

View solution in original post

4 REPLIES 4

miked_jones
Giga Expert

You can combine the two into a single javascript statement, but if you mean can you have javascript:<code> more than once, then no. 

You'd need to write it out a single line of javascript. 

Cody Smith _ Cl
Tera Guru

You can use a large Script. (if the script gets too large you can call a script include to return the query instead)

 

javascript:
var refQual = 'install_statusNOT IN12,15,7,14^sys_class_name=cmdb_ci_aix_server^ORsys_class_name=cmdb_ci_computer';

if (!(gs.getUser().isMemberOf("ABC"))) {
  refQual += "^sys_id!=000000000000000000";
}

refQual;

 

If my answer was helpful, or solved your issue, please mark it as Helpful / Correct.
Thank you,
Cody Smith

That's it, it works like a charm!!

I just changed my first line of code as you suggested and it is working now. Both of the ref quals.

Thanks a ton!

Su

Good! I am glad it worked out (: