- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 03:23 AM
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
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 03:32 AM
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);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 03:49 AM
the changes which i had suggested did not work ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 04:09 AM
Unfortunately, it didn't work for me

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 04:22 AM
it's working perfectly fine at my end.
thanks for participating on community.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 03:34 AM
Hi NK,
If you would prefer to use the g_form.setSectionDisplay function (which I personally find neater), the parameters should be ('security_incident',false) or true.
g_form.setSectionDisplay('security_incident',true);
g_form.setSectionDisplay('security_incident',false);
This is because the name value is the lower-case letters and whitespace replaced with underscores, much like a Label-Name relationship for a field or Catalog Item variable if the label is written first.
Otherwise the logic seems sound, and Harshvardhan's solution should function also.
Kind Regards,
Astrid