How to hide submit button in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2021 04:18 AM
Can someone help on how to hide submit button in Service Portal ?
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2021 04:20 AM
var items = $$('BUTTON').each(function(item){
if(item.innerHTML.indexOf('Submit') > -1){
item.hide();
}
});
Tried above code but its not working in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2021 04:27 AM
Hi,
this would work both native + portal
1) Ensure Isolate Script field is set to false for this client script
2) this field is not on form but from list you can make it false
function onLoad() {
//Type appropriate comment here, and begin script below
if(window == null){
// for portal
var z = this.document.getElementsByClassName("btn btn-primary btn-block ng-binding ng-scope");
z[0].style.display = 'none';
}else{
// for native
document.getElementById("submit_button").style.display = 'none';
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2021 05:25 AM
Many thanks Ankur,
I tried above code I am getting
var z = this.document.getElementsByClassName("btn btn-primary btn-block ng-binding ng-scope");
I am getting [object HTMLCollection] for above code
but later it fails I get error 'TypeError: Cannot read property 'style' of undefined'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2021 05:28 AM
for your client script as I said do this
1) Ensure Isolate Script field is set to false for this client script
2) this field is not on form but from list you can make it false
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader