How to hide variables in variable editor in incident or custom table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 11:24 PM
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.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 11:33 PM
Hi Arjun,
Why not write a UI policy or an onLoad client script for this instead of query business rule ?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2019 12:13 AM
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);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2019 12:37 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 02:41 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader