THURSDAY, JANUARY 19, 2017

Granular Control of Form Tab Toggle Behavior via Client Scripts

T

his post comes to you from ServiceNow’s Knowledge14 event in San Francisco. It’s exciting to see all of the new innovations that ServiceNow is introducing in the upcoming releases. I’ve been very involved with my company, Crossfuze Solutions, as a sponsor of the conference and it’s been incredibly rewarding to showcase our solutions and talk to so many of you about how Crossfuze and ServiceNow Guru have helped you to be successful in implementing and enhancing ServiceNow. If you’re here at the conference, please stop by booth #421 during the expo hours and say hello!

Today’s post comes in response to a question posted on the ServiceNow community about providing more granular control over the form and list tabbing behavior for specific tables and conditions. If you’re familiar with ServiceNow, you know that this cannot be done natively and that tabbing is based off of a user preference that is enforced globally for the user accessing the system. Continue reading to see how to add more flexibility to your form tab behavior!

Granular Tab Control

‘tabbed.forms’ User Preference

As background, the first thing you should know is that the user preference (accessed from the ‘User Preferences’ module) that controls this behavior is ‘tabbed.forms’. You can set this globally as a default or set it individually directly from the table record if needed.

Controlling the ‘tabbed.forms’ User Preference from a client script

In most cases, simply clicking the icon in the top-right corner is all you need to toggle tabbing within your forms. In the event that you need to do that through scripting, a client script is your answer. You can toggle the tabbing globally for a user with the following code…

tabs2Toggle();

Granular control…WITHOUT impacting the user preference

The problem with the script above is that YOU’LL PROBABLY NEVER USE IT! I can’t think of a single scenario where you would want to toggle tabs and have that user preference enforced for a user globally. You’d just set the global default preference and be done with it.

This becomes MUCH more useful though if you can control the tabbing behavior without modifying the system property. Maybe you want to just expand the form sections for a particular table based on a specific condition without impacting the list tabs and without impacting the behavior anywhere else. The following can be used in your client scripts to accomplish this…

g_tabs2Sections.deactivate(); //Deactivate form tabs
g_tabs2Sections.activate(); //Activate form tabs
g_tabs2List.deactivate(); //Deactivate list tabs
g_tabs2List.activate(); //Activate list tabs

Want to learn more about controlling the behavior of tabs and form sections in ServiceNow? Check out these other articles for more information!

2 Comments

Daniel K 16-05-2014, 10:35

This article has helped us control our form content immensely! I appreciate you taking the time to answer this question.

Reply
Mark Stanger 16-05-2014, 10:43

Thanks for letting me know! I’m glad it helped, that goes a long way to making it worth it to help people out :).

Reply

Leave a Reply


Latest Comments

  • David: It appears that I can hit sys_properties table with REST. This works, but I haven’t yet discovered the...
  • Mark Stanger: Hey David, It doesn’t surprise me that scoped apps have made this more difficult. I’m not...
  • David: Mark, do you have an example of how to do this in a scoped app? It seems there are many hoops to jump through...
  • Mark Stanger: The only possibility is to create a system property to override this in your application. Check out the...