How to hide variables in variable editor in incident or custom table

aj2403
Tera Expert

Hi,

 

I have a record producer which is to create incident. i have few fields which needs to be hide in the incident variable editor.

My variables structure is

Caller -reference

short description - single line text

priority - drop down(if priority is 1, the "variable "Reason " in variable editor has to be visible, if priority is 2,3,4, then it should be not visible"

Reason - single line text

I am trying to write display business rule by quering (question_answer). no luck.

Can anyone help me on this.

 

Thanks.

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Arjun,

Why not write a UI policy or an onLoad client script for this instead of query business rule ?

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Its not working and my script is 

 

var hideTypes = [];
hideTypes.push("10"); //Label

g_scratchpad.emptyVars = "";

var emptyVars = [];
var producerVars = new GlideRecord("question_answer");

producerVars.addQuery("table_sys_id", current.sys_id);

producerVars.query();


while (producerVars.next()) {
//emptyVars.push(producerVars.question.name.toString());
if (producerVars.question.type == "1" && producerVars.value == "Yes") {


emptyVars.push(producerVars.question.name.toString());


continue;
}
}

 

 

 

client script is 

 

if(g_scratchpad.emptyVars != ''){
var emptyVars = g_scratchpad.emptyVars.split(',');
for(i = 0; i < emptyVars.length; i++){
g_form.setDisplay('variables.' + emptyVars[3], false);
g_form.setDisplay('variables.' + emptyVars[4], false);
g_form.setDisplay('variables.' + emptyVars[5], false);
}
}

Hi Arjun,

So display business rule you have created on record producer table. it won't work i.e. display business rule on that table

you want the variables to be removed on the incident form and not on the record producer form right?

why not create UI policy or client script on incident table?

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Arjun,

Any update on this?
Can you mark my answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader