Hide form section onLoad still very briefly displays tab before hiding

desertmoxie1
Tera Expert

Hi - I created a Client Script based on ServiceNow Guru to hide the Demand form's Assessment Data tab.  However, when I go to an existing demand, I see the assessment data tab for a micro-second before it disappears.  Is this really the best way to hide it?  I don't want people calling me about a tab that 'went away'....  Thanks!

Client Script on Demand [dmn_demand] table; Type = onLoad

function onLoad() {
//Hide assessment data section
g_form.setSectionDisplay('assessment_data', false);
}

 

 

1 ACCEPTED SOLUTION

Subrahmanyam2
Giga Guru

Hello,

Clients scripts execute first before UI policies.
But if you have other client scripts which are taking longer timer to load, then during that time the tab will be visible.
If you want to reduce the time it displays before an user can action on tab, then you can order the client scripts using the Order field and make sure that your script executes first. [Order field is present in client scripts but you need to configure it in form or use it in list view if you really need it]
If I remember correct, client scripts without any order value will execute first, if there are multiple client scripts without order value, then the order is decided by system on how they are loading in browser.

Even with all of these, if the internet connectivity of the end users are slow, then there is still a chance that tab will appear while the form is rendering.
The reason is, until the system renders all fields it will not apply any scripts or policies.

If you do not want the fields to be visible, you may have to write ACL's as per your business need and make sure you restrict them at the server side if that is possible.
Unfortunately it is not feasible to do it in this manner all the time.

There are some tradeoffs we may need to live with in some cases.

Hope this helps!

 

Thanks and regards,

Subrahmanyam Satti

View solution in original post

5 REPLIES 5

Thank you!  I had actually set the order to after the system client scripts, but will move mine first. 🙂