How to hide variables section or incident variable editor on the incident form?

dharanikumar
Giga Guru

Hi All,

I want to hide the Variables section / Incident Variable Editor on the incident form.

Steps to re-produce in our OOB instances:

1. User Self Service -> Click on Service Catalog.

2. Search for Create Incident and open it. Fill the required fields and submit the record.

3. Incident will be created and would be shown in self-service view. Change the view to default view. Then we can see the variables available in variables section / Incident variable editor. Please refer to the below screenshot.

find_real_file.png

Tried Steps:

1. Created a Catalog UI Policy and set this to target record level. It is hiding the variables but the section will available on the form. Something it is like empty variables section.

2. Created Catalog Client Script on the and set this target record level. The same is happening here it will hide the variables but the section will be available.

3. I thought if we the hide all the related variables which are available in the variables section / Incident Variable Editor. Then the variables section will be auto hided.

4. For some reasons the section will available there. Please check the below screenshot.

find_real_file.png

Please suggest me how to achieve this. 

-Dharani

14 REPLIES 14

Its definitely not recommended but sometimes there is no other way. That is why initially i approached using section(put the variable editor in a different section) and hide the section as needed using oob functions.

But that is not working out here

so...

-Anurag

A cleaner code to achieve the same

var ve = $('variable_map').up('table');
ve.style.display='none';

 

Please mark my answer correct/helpful if it helped you solve your issue.

-Anurag

-Anurag

siva_
Giga Guru

Not sure why the view is different in my case , i followed the same steps as suggested but am not able to see it on my form 

If its not an RITM and if its a custom form then check whether the variable editor macro kind of thing has been added on to the form  just remove it from the configure - > form layout or if the form has sections then you can hide the sections in the form as shown below 

 

GlideForm - getSectionNames()

Returns all section names, whether visible or not.

Parameters
NameTypeDescription
None  
Returns
TypeDescription
Array of stringsThe section names.

GlideForm - getSections()

Returns an array of the form's sections.

This method is not available on the mobile platform. If this method is run on a mobile platform, no action occurs.

Parameters
NameTypeDescription
None  
Returns
TypeDescription
Array of HTML elementsThe form's sections.
function onChange(control, oldValue, newValue, isLoading) {
   //this example was run on a form divided into sections (Change form)
   // and hid a section when the "state" field was changed
   var sections = g_form.getSections();
   if (newValue == '2') {
      g_form.setSectionDisplay(sections[1], false);
   } else {
      g_form.setSectionDisplay(sections[1], true);
   }
}

Hope that helps

Thanks
Siva


Mark this as correct if that really helps

harleyl
Giga Contributor

If you always want the Variables section hidden, why not just configure the form layout and remove incident variable editor?

 

find_real_file.png

SanaPR
Giga Guru

Hi Dharani

Did you find any acceptable solution for this? I need to hide variables section on Change form.

Mine is a Record Producer with many variables. Since all of them are mapped to the fields in change request I don't want Variables section visible anymore. Let me know if you found any script that helped you achieve this.

ThankYou,

Sumana