Change UI action button color

farci
Mega Expert

Hi,

I am struggling here to change the UI action button color to green when the button name is Approve and Red for button with name Reject.

Change the Color of Form Buttons - ServiceNow Guru

I also looked at the above link but to no avail.

You quickest response on this is appreciated.

Regards,

Narmi

1 ACCEPTED SOLUTION

You should be all set now. I went in and added a console.log statement inside of your "catch". This gave me the information that jquery was inaccessible, which in a scoped app it is not by default. (Scoped Applications and Client Scripts: A Primer )



I created a system property for you "x_69534_superduper.glide.script.block.client.globals" which enables this. (ServiceNow )



I disabled all of the alerts and the timeout that were set through testing and everything seems to work now.


View solution in original post

25 REPLIES 25

alexg_
Giga Contributor

This post might be a bit old, but the client script below might help you when defining a colors for your buttons:

function onLoad(){
	
	buttonColors('reject', 'red', 'white');
	buttonColors('approve', 'green', 'white');
	}
													
function buttonColors(buttonId, backgroundColor, color){
	try{
		$j("[id=" + buttonId + "]").css("background-color", backgroundColor).css("color", color);
															
		} catch(e) {console.log(e);}
}