Always focus on "notes" tab in the incident form

priisholm
Mega Expert

Hi

Assume that the user resolved and saved the last incident, which placed him on the "Closure Information" tab/section.

When he opens another incident or starts a new one, he should always focus on the "notes" tab/section, not on the "Closure Information".

I have tried different things including this: Re: Re: Default Focus Field on Incident Form Load

Can you give me a hint?

Thanks

Soren

1 ACCEPTED SOLUTION

You are correct. I thought I read about setting focus in there somewhere.



If you want to force the tab to always be the default, you would have to work with the appropriate record in sys_user_preference. The user preference always remember the tab the user selected last. You would have to create (or update) the record to the value you wanted. Here's an example of the value I see when I click the Notes tab on incident (tab #0). Note the value is empty. When I click the next tab, it gets set to 1.


find_real_file.png



If you want this to be the default, you could write an business rule on sys_user_preference that watches for specific names getting updated and force them to a value.



The problem I see in this is when I'm working on tab #2 (the third from the left), enter some information and save, the form is going to redraw and force me to the first tab again. As a user, this could get annoying. "Hey, I was just working over there, why am I thrown back here?"


View solution in original post

8 REPLIES 8

Chuck Tomasi
Tera Patron

Hi Soren,



I wouldn't recommend that solution, even if it did work because it employs DOM manipulation. Using this is a bad practice as it is likely to break in future upgrades when the DOM changes (as it has in the past.)



Take a look at getSections() and setSectionDisplay() methods in the GlideForm page. You can use a client script that calls the g_form methods to identify which sections are available and select the appropriate one.



https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=c_GlideFormAPI


Hi Chuck



Shouldn't setSectionDisplay() not only be used when you want to hide a section/tab ? (not change focus)



BRs


Søren


You are correct. I thought I read about setting focus in there somewhere.



If you want to force the tab to always be the default, you would have to work with the appropriate record in sys_user_preference. The user preference always remember the tab the user selected last. You would have to create (or update) the record to the value you wanted. Here's an example of the value I see when I click the Notes tab on incident (tab #0). Note the value is empty. When I click the next tab, it gets set to 1.


find_real_file.png



If you want this to be the default, you could write an business rule on sys_user_preference that watches for specific names getting updated and force them to a value.



The problem I see in this is when I'm working on tab #2 (the third from the left), enter some information and save, the form is going to redraw and force me to the first tab again. As a user, this could get annoying. "Hey, I was just working over there, why am I thrown back here?"


Thanks!



I will try it - but you are correct that it could be really annoying for the user!!



BRs


Søren