How to hide back button in form?

Sadique Kabir
Tera Contributor

Hi All,

How to disable the Back button in Service Now.

Did anyone worked on this. Any help will be greatly appreciated.

Regards,

Sadique

Note:- I have already tried some methods/codes that is available in community but not working.

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @Sadique Kabir,

 

This can be achieved with 2 steps as outlined below, however, I would like to ask what you're trying to achieve by removing this? What happens if someone uses the back button in the browser itself?

 

To answer your question directly however:

- Create below onLoad client script

- Make sure the 'isolate script' column for this script is set to false (Default is set to true to prevent DOM manipulation) - See below.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

 

Script:

function onLoad() {
    // This hides the back button
	document.getElementsByClassName("btn btn-default icon-chevron-left navbar-btn")[0].style.display="none"; 
}

 

'Isolate script' set to false. (see below)

Screenshot 2024-03-26 at 09.17.04.png

View solution in original post

10 REPLIES 10

Hi @Sadique Kabir 

 

Got your point, but the behaviour of this back button is actually wired some time. If you open many tabs it pick from history and take to back. I had very bad experience with this.

 

You can try @Robbie  solution. 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Please see my response @Sadique Kabir.

I have provided a tried and tested solution.

 

Thanks @Dr Atul G- LNG for highlighting this.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

 

Thank You @Robbie

Your Solution is working...

Robbie
Kilo Patron
Kilo Patron

Hi @Sadique Kabir,

 

This can be achieved with 2 steps as outlined below, however, I would like to ask what you're trying to achieve by removing this? What happens if someone uses the back button in the browser itself?

 

To answer your question directly however:

- Create below onLoad client script

- Make sure the 'isolate script' column for this script is set to false (Default is set to true to prevent DOM manipulation) - See below.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

 

Script:

function onLoad() {
    // This hides the back button
	document.getElementsByClassName("btn btn-default icon-chevron-left navbar-btn")[0].style.display="none"; 
}

 

'Isolate script' set to false. (see below)

Screenshot 2024-03-26 at 09.17.04.png

Hi Robbie,

 

This script is not working on records which pertains to a scoped application. It works well in forms like Incident, problem etc., Do you know how to make this work on forms which are related to applications other than global?

 

Regards,

Indirakumar