- 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:45 PM
Hello Swetha,
You need to use g_form.setSectionDisplay('resolution_information', false), to hide the section.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 10:48 PM
Here is the complete script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue=='1'){
g_form.setSectionDisplay('resolution_information', false);
}
g_form.setVisible('close_code',false);
g_form.setVisible('close_notes',false);
if(newValue=='6'){
g_form.setSectionDisplay('resolution_information', true);
g_form.setMandatory('close_code', true);
g_form.setMandatory('close_notes', true);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 10:47 PM
Hello,
If this is tab that name you have mentioned in script should be"resolution_information".
var sectionM = g_form.getSections();
g_form.setSectionDisplay('resolution_information', false);
If my answer is useful mark correct!
Br,
pratiksha.k
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 10:55 PM
Hi,
please find responses to points below
I believe point 3 is OOB; so it should work it makes both the fields as mandatory when state changes to resolved
for script give this to hide section
g_form.setSectionDisplay('resolution_information', false);
for showing section use this
g_form.setSectionDisplay('resolution_information', true);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader