The CreatorCon Call for Content is officially open! Get started here.

Client Script Action to click on Section tab

chaslage
Kilo Guru

We have a group of fields on a form that are required and in a Section tab, if you click on a "Close" button then it will start the Client Script to check if they have been filled in. If you have the tab open and you add some mandatory fields then it will go right to that field. However, if you are not selected on that tab, it takes you to the tabs but you have to select on the tab that is Red.

I would like to go one further and have that tab automatically open upon click of the "Close" button. Is there a trick with SN to do this or do I have to employ CSS?

Thanks!

14 REPLIES 14

It's onSubmit, weird... I put it on a 50ms delay on the call and it works:


setTimeout(function (){ switchSectionTab("Closure Information"); }, 50);


chaslage
Kilo Guru

Mark,

I have to come back to the well (this topic) for some more, though I want to focus on Related Lists. What I want to do is if they are in a certain view, I want to hide some Related List tabs they don't need to see.

With the code on setting active, is there an easy way to do this with some CSS or is there something a bit more tricky in ServiceNow to hide certain tabs?

Thanks!


Hiding related lists can be done in client scripts. Here's another SNGuru article.

http://www.servicenowguru.com/scripting/client-scripts-scripting/hiding-related-lists-embedded-lists/


Is it possible to set a section as the active section in the same way as this now that sections can be called by name?


Hello Mark,



Can we rename Section Tabs name g_tabs2Sections if yes then can u provide me some code for that .



I am building an application so there is a restriction that it should work on Application Scope. i was trying using DOM but it doesn't worked.



Regards Kumar



Application Developer


!nMorphis Services Pvt Ltd