- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2020 10:30 PM
Hide/Show Related Tab Named-"Resolution Information "
1- Related Tab Named-"Resolution Information " by default should be hidden.
2- Related Tab Named-"Resolution Information " visible when the incident state is "Resolved".
3- Under Related Tab Named-"Resolution Information " field Named- "Resolution code" and "Resolution notes" also mandatory when the incident state is "Resolved".
I am new to service now,I don't know if Resolution Information have any back end name, i was not able to find it. So correct my code to get the output.
Client Script ...onChange...Field..state...
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue=='1'){
g_form.setVisible('Resolution Information',false);
}
g_form.setVisible('close_code',false);
g_form.setVisible('close_notes',false);
if(newValue=='6'){
// g_form.setVisible('Resolution Information',true);
g_form.setMandatory('close_code', true);
g_form.setMandatory('close_notes', true);
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2020 11:23 PM
Hi,
In addition to above points
try below
OnChange client script on incident State
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
//This onchange client script will work on onLoad also
if (newValue == '') //remove isLoading and change newValue === to newValue ==
{
return;
}
if(newValue=='1')//if incident state is new then hide releted tab resolution information
{
g_form.setSectionDisplay('resolution_information', false);
}
g_form.setDisplay('close_code',false);
g_form.setDisplay('close_notes',false);
if(newValue=='6'){
g_form.setSectionDisplay('resolution_information', true);
g_form.setMandatory('close_code', true);
g_form.setMandatory('close_notes', true);
}
}
Thanks,
Kunal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2020 10:59 PM
Hello Swetha,
Below please find link to ServiceNow docs for more detailed info on
setSectionDisplay(String sectionName, Boolean display)
Parameters:
Name | Type | Description |
---|---|---|
sectionName | String | The section name is lower case with an underscore replacing the first space in the name, and with the remaining spaces being removed, for example "Section Four is Here" becomes "section_fourishere". Other non-alphanumeric characters, such as ampersand (&), are removed. Section names can be found by using the getSectionNames() method. |
display | Boolean | When true shows the section. When false hides the section. |
Return:
Type | Description |
---|---|
Boolean | Returns true when successful. |
- Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2020 11:23 PM
Hi,
In addition to above points
try below
OnChange client script on incident State
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
//This onchange client script will work on onLoad also
if (newValue == '') //remove isLoading and change newValue === to newValue ==
{
return;
}
if(newValue=='1')//if incident state is new then hide releted tab resolution information
{
g_form.setSectionDisplay('resolution_information', false);
}
g_form.setDisplay('close_code',false);
g_form.setDisplay('close_notes',false);
if(newValue=='6'){
g_form.setSectionDisplay('resolution_information', true);
g_form.setMandatory('close_code', true);
g_form.setMandatory('close_notes', true);
}
}
Thanks,
Kunal