Code to change Section Name using g_tabs2Sections

kumarsatyam
Tera Expert

Hello SNOWers,

Can anyone suggest me how can i write code using g_tabs2Sections to rename my Tab.

Note : In Application Scope DOM not works . So i have tried everything.

In this link i got some methods for g_tab2Sections but to rename tab there is no such functions given even in console i don't

got any method .

pradeepksharma shloke04 ctomasi

Client Script Action to click on Section tab

Regards Kumar

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Kumar,



In the standard forms UI (eg client scripts, client ui actions) - by default, we block access to the DOM and certain top-level globals (window, document, $ / jquery). You can enable an application-specific property to gain access to the DOM.


You can enable an application-specific property to gain access to the DOM. This provides a good tradeoff by setting a default with best practice guard rails, and allowing a developer to take explicit action to opt out of the best practice.



With the explicit property ServiceNow can:


On store submission, know that an app wants raw DOM manipulation and can pay more attention to it in the certification process Give it a lower "upgradability/maintainability" score Warn the developer on submission that they are going to need to re-certify the app on every major release, etc.


To opt out of the best practice create the following property in your scope and set it to false. glide.script.block.client.globals


View solution in original post

5 REPLIES 5

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Kumar,



In the standard forms UI (eg client scripts, client ui actions) - by default, we block access to the DOM and certain top-level globals (window, document, $ / jquery). You can enable an application-specific property to gain access to the DOM.


You can enable an application-specific property to gain access to the DOM. This provides a good tradeoff by setting a default with best practice guard rails, and allowing a developer to take explicit action to opt out of the best practice.



With the explicit property ServiceNow can:


On store submission, know that an app wants raw DOM manipulation and can pay more attention to it in the certification process Give it a lower "upgradability/maintainability" score Warn the developer on submission that they are going to need to re-certify the app on every major release, etc.


To opt out of the best practice create the following property in your scope and set it to false. glide.script.block.client.globals


Thanks pradeepksharma . you are simply superb.. Using of this property will not cause any bad consequences ?



Can i use this without any fear ?


Thanks Kumar for your kind words.



Avoid Document Object Model (DOM) manipulation if possible. It can cause a maintainability issue when browsers are updated.


Instead, use the GlideForm API or consider a different approach for the solution. In general, when using DOM manipulation methods, you have to reference an element in the DOM by id or using a CSS selector. When referencing out-of-box DOM elements, there is a risk that the element ID or placement within the DOM could change thus causing the code to stop working and/or generate errors. While we are not saying this should never be done, it needs to be done with forethought, caution, and a full understanding of the risk you are incurring. It is recommended to review these objects and reduce the use of DOM manipulation methods as much as possible.



Reference:


http://wiki.servicenow.com/index.php?title=Client_Script_Best_Practices#gsc.tab=0


Dear pradeepksharma,



Since right now i don't have such any other solution so i have to go with DOM . If u have any other method do suggest me .



Thanks and regards



Kumar