How to display the section/tab in incident form ?

NK32
Kilo Expert

Hi Team,

I would like to display the section/tab(Security Incident) when the 'Incident Type' is chosen 'Security Incident'.
The section/tab(Security Incident) should be hidden when the 'Incident Type' is not chosen 'Security Incident'.

Client script :

Type: Onchange
function onChange() {
var sections = g_form.getSections();
if(g_form.getValue("u_template") == "Security Incident"){
sections[5].style.display='none';
}else{
sections[5].style.display='block';
}
//g_form.setSectionDisplay('Security Incident', false);
}

Kindly assist on this please

Regards,
NK

1 ACCEPTED SOLUTION

Ashish Dhole2
Kilo Expert

Try below script

//Type: Onchange
function onChange() {
g_form.setSectionDisplay('security_incident', false)
if(g_form.getValue("u_template") == "Security Incident")
{
  	g_form.setSectionDisplay('security_incident', true);
}
else
{
	g_form.setSectionDisplay('security_incident', false);
}

}

View solution in original post

8 REPLIES 8

Harsh Vardhan
Giga Patron

try now

Type: Onchange
function onChange() {
var sections = g_form.getSections();
if(g_form.getValue("u_template") == "Security Incident"){
sections[4].style.display='none';
}else{
sections[4].style.display='block';
}
//g_form.setSectionDisplay('Security Incident', false);
}

Harsh Vardhan
Giga Patron

array index would be 4 here. 

it starts from 0 index 

Ashish Dhole2
Kilo Expert

Try below script

//Type: Onchange
function onChange() {
g_form.setSectionDisplay('security_incident', false)
if(g_form.getValue("u_template") == "Security Incident")
{
  	g_form.setSectionDisplay('security_incident', true);
}
else
{
	g_form.setSectionDisplay('security_incident', false);
}

}

This worked for me Thanks 🙂