How to hide submit button in Service Portal

NewBee
Kilo Contributor

Can someone help on how to hide submit button in Service Portal ?

23 REPLIES 23

NewBee
Kilo Contributor

var items = $$('BUTTON').each(function(item){
   if(item.innerHTML.indexOf('Submit') > -1){
      item.hide(); 
   }
});

 

 

Tried above code but its not working in client script

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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'

 

@NewBee 

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

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader