Override reference qualifier

traviswarren
Kilo Expert

I am attempting to create an OnChange Client Script that will change the value of the specific Override Reference Qualifier from True to False. The only trouble I have is the syntax to change this value when a specified condition is true. Below I will give you my attempts to access this variable and hopefully someone can lead me in the correct direction.

I believe the one liner should be something like this...

Attempt 1: task.cmdb_ci.sys_dictionary_override.reference_qual_override="false";
Attempt 2: sys_dictionary_override.sc_req_item.cmdb_ci.reference_qual_override = "false";
Attempt 3: sys_dictionary_override.sc_req_item.cmdb_ci.reference_qual_override = 'false';

Thank you in advance.

13 REPLIES 13

MKhan1
Giga Contributor

Did you already have something in the attribute field of the variable?. If yes, then it will not override. Remove it from the attribute of hte variable and use a IF ELSE condition in the onChange client script to set the reference qualifier..


I will attempt to explain myself in more detail with a little background of my scenario.

Currently I have a CI field and a CI Class field. Currently, you can choose a CI Class and the CI reference field will only populate the CI's in the corresponding CI Class. This is because the Dictionary override - override reference qualifier is set to True on the sc_req_item.

At the time, a user can only submit a CI if they know what CI class its in.

I want the user to still have the option to type in a CI without having to know the CI Class.

I wrote a OnChange Client script that checks for when the CI Class is none; tested and functional. What I am looking for is the syntax or a one liner that would change the Override reference qualifier from True to False so a user can type in a CI without knowing the CI class.

I hope this helps us both.


You can write a custom Dictionary override, by call a function in you override.
Override condition: javascript:getMyCondition();

Then define your function:
function getMyCondition(){
if (current.u_ci_class != ''){
return 'sys_class_name='+current.u_ci_class;
} else {
return '';
}
This is explained in more details under 'Advanced Reference Qualifiers on the WIKI:
http://wiki.servicenow.com/index.php?title=Reference_Qualifiers#Advanced_Reference_Qualifiers


Thanks for the reply. I was just working on a script include call. Not finished yet but this reply will help me out. I will reply back if everything works out.

Thanks again!