
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 02:44 AM
Hi, my question comes in two parts:
We have three form tabs on our incident form - notes, related records and resolution details, with notes the default active tab. Firstly, I created a basic on load client script to change the active tab from notes to related records, which worked fine (g_tabs2Sections.setActive(1);). However, when I made the client script inactive and reloaded the incident form, the related records tab remained the active tab. Does ServiceNow change system properties when this script is used??
Now my main issue. The resolution tab only appears when the incident state changes to resolved. The user has to fill in mandatory fields before they can save (so its not possible to save the state to resolved and then complete the resolution details - they have to change the state, fill out the fields and then save all together). I am trying to script it so that when they change the state to resolved, the Resolution Details tab appears as the active tab (at present they have to click on it to change the active tab from notes to resolution). I tried the following onLoad client script, but it doesnt change the default notes tab
function onLoad() {
var gr = new GlideRecord('incident');
gr.addQuery('state','resolved');
gr.query();
if (gr.next()) {
g_tabs2Sections.setActive(2); }
}
Note sure if this is my script (probably!) or totally the wrong approach. Can anyone advise please
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 08:47 AM
The following on change script has solved the issue:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (g_form.getValue("state") == "6"){
g_tabs2Sections.setActive(2);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 03:15 AM
Hi ,
You want to make Close Notes section active but that behaviour already exist for onCHange of state to Resolved so I want to know
y are u implementing the same .
But, still if you have some reasons for it then follow the below link it will give you correct idea about how to script the same.
https://www.servicenowguru.com/scripting/client-scripts-scripting/changing-active-tab-selection-servicenowcom/
Mark my ANSWER as CORRECT and HELPFUL if it helped.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 04:05 AM
Thanks Creatiethinker,
The issue is that when the user sets to Resolved, they have to make an additional mouse click to fill out the Resolution details. It would be a better user experience if it opened that tab directly. I had been looking at the servicenowguru page to try and come up with a solution, but to no avail

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 08:47 AM
The following on change script has solved the issue:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (g_form.getValue("state") == "6"){
g_tabs2Sections.setActive(2);
}
}