Comments on: Removing Form Buttons https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 21:26:39 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Hiroto Sakai https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6913 Thu, 18 May 2017 07:52:25 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6913 In reply to Hiroto Sakai.

>> $ (Prototype), $$ (Prototype selector)
Fortunately, I reached a self-solve. Thanks to the great pioneers!
http://sncommander.com/some-common-hurdles-in-scoped-apps-in-servicenow/

]]>
By: Hiroto Sakai https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6912 Wed, 17 May 2017 15:58:06 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6912 In reply to David Martin.

On Application [Global], this worked fine in Istanbul P3a. But if not [Global], I couldn’t hide the Back Button.
Does anyone know why this difference occurs?
Thanks.

function onLoad() {
$$(‘.icon-chevron-left’)[0].hide(); // Back Button
}

]]>
By: Asha Patil https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6911 Wed, 10 May 2017 09:28:52 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6911 Nice Article. Very useful

]]>
By: Mark Stanger https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6910 Fri, 08 Jul 2016 06:39:26 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6910 In reply to Rewanth.

I’ve updated for later ServiceNow builds. Give the updated script a try.

]]>
By: Rewanth https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6909 Wed, 06 Jul 2016 23:33:59 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6909 In reply to Mark Stanger.

Hi Mark,

I did try this and its not hiding the context menu :(

Regards,
Rewanth

]]>
By: Mark Stanger https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6908 Wed, 28 Oct 2015 11:27:48 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6908 In reply to Hari.

There’s no way to do this as far as I know.

]]>
By: Hari https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6907 Wed, 28 Oct 2015 07:25:29 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6907 In reply to Mark Stanger.

is there a way to hide just a single option from the context menu instead of the complete context menu? like if i just want to hide the ‘Save as template’ ..

]]>
By: David Martin https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6906 Wed, 29 Apr 2015 17:21:58 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6906 In reply to David Martin.

Hi Mark

I’ve just done some further testing, this works as Admin but the bottom 2 are not removed for anyone else. Any ideas why this might be doing this.

]]>
By: David Martin https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6905 Wed, 29 Apr 2015 17:04:12 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6905 These may come in useful for someone in Eureka, removes the various options on the left of the bar.

function onLoad() {
$$(‘.icon-chevron-left’)[0].hide(); //Back Button
$$(‘.icon-menu’)[0].hide(); // Context Menu
$$(‘.pointerhand’)[0].hide(); // Current View and record number
$$(‘.icon-label’)[0].hide(); // tag button
}

]]>
By: June Ralph https://servicenowguru.com/client-scripts-scripting/removing-form-buttons/#comment-6904 Fri, 20 Feb 2015 15:20:30 +0000 https://servicenowguru.wpengine.com/?p=1558#comment-6904 Hi, I need help, I have the following client script that I want to hide 3 options in the state field and the Resolve Incident button based on the severity field and if the person has the severity_manager role. Hiding the options works but hiding the Resolve Incident button doesn’t. We want only Severity Managers to be able to Resolve/Close these tickets. Can anyone tell me what is wrong with my code ????

function onLoad() {
	var isTRC = g_user.hasRole('severity_manager');
	var severity = g_form.getValue('severity');
	var state = g_form.getValue('state');
//	alert(isTRC);
	if (!isTRC && (severity == '1' || severity == '2'|| severity == '3'|| severity == '4'|| severity == '10')){
		g_form.removeOption('state', 6);
		g_form.removeOption('state', 7);
		g_form.removeOption('state', 9);
		
		//Remove the 'Resolve Incident' button
		var items = $$('BUTTON').each(function(item){
   if(item.innerHTML.indexOf('resolve_incident') > -1){
      item.hide();  
   }
});	
	}
}
]]>