Granular Control of Form Tab Toggle Behavior via Client Scripts

///Granular Control of Form Tab Toggle Behavior via Client Scripts

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!

By | 2018-07-09T14:59:52+00:00 April 30th, 2014|Categories: Client scripts|Tags: , , |3 Comments

About the Author:

Mark has worked in the IT industry since 2002 and with ServiceNow since 2007. He is the founder and creator of SN | Guru and the co-founder of Crossfuze, one of the worlds leading ServiceNow consulting partners. Prior to co-founding Crossfuze, he worked for ServiceNow as a Senior Architect on the Professional Services team. He has personally led dozens of successful implementations encompassing every part of the ServiceNow platform. He is also responsible for designing and developing groundbreaking ServiceNow solutions and best practices in the form of various applications, turnkey solutions, and integrations during his tenure at ServiceNow, Crossfuze and, of course, SN | Guru. These solutions are used today by ServiceNow administrators and consultants alike in hundreds of ServiceNow instances around the world!

3 Comments

  1. Daniel K May 16, 2014 at 10:35 am - Reply

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

    • Mark Stanger May 16, 2014 at 10:43 am - Reply

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

  2. Alex C September 13, 2017 at 1:06 pm - Reply

    Hey Mark,

    This used to work, not sure if our upgrade to Helsinki might have killed it? Is there and updated script or an alternative??

    Thanks!

Leave A Comment