- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 10:49 AM
Using the document https://www.servicenowguru.com/scripting/client-scripts-scripting/removing-form-buttons/ I created a client script to Hide the Submit button.
- Table: Change Request [change_request]
- UI Type: Desktop
- Type: onChange
- Field name: Type
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == 'Routine') {
//Remove the 'Submit' button
var items = $$('BUTTON').each(function(item) {
if (item.innerHTML.indexOf('Submit') > -1) {
item.hide();
}
});
}
}
When the client script runs I get the error onChange script error: TypeError: $$ is not a function function() { [native code] }
Am I missing something?
Thank you,
Stacy
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 12:05 PM
Hi,
If you want to use this script then you have to make sure that isloate script flag on client script is false. Which will allow you to use DOM manupiluation.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 11:39 AM
since a few versions ServiceNow removed default dom access.
Better way is modify the button conditions on when to show it or not.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 12:05 PM
Hi,
If you want to use this script then you have to make sure that isloate script flag on client script is false. Which will allow you to use DOM manupiluation.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 05:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 12:26 PM