- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 05:30 AM
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
Solved! Go to Solution.
- 14,602 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2016 06:14 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2016 05:16 AM
I am using Helsinki UI16
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2016 05:26 AM
Hi Alex,
I am see the code run fine till my First Error alert message and later on it does not work.
function onLoad() {
setTimeout(function(){
//Change the color of the 'Approve' button to green
changeButtonColor('approve', '#00CC00');
//Change the color of the 'Reject' button to red
changeButtonColor('reject', '#CC0000');
}, 1000);
}
function changeButtonColor(buttonID, backgroundColor) {
try{
alert('Error Please check First');
//Find the button(s) by ID and change the background color
$$('button[id=' + buttonID + ']').each(function(elmt) {
alert('Error Please check Second');
elmt.style.backgroundColor = backgroundColor;
alert('Error Please check Third');
elmt.style.color = '#ffffff'; //make the button text white
});
}catch(e){}
}
Regards,
Farci
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2016 05:31 AM
inside of your catch(), add alert(e) or console.log(e) and let me know the error that is thrown
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2016 05:34 AM
Since this is a developer instance, would you be able to create a login for me and I can take a look? I send you a connection request so that we could private message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2016 07:49 AM
Logged in but do not have the admin rights needed to look at everything. Also, you can remove that login info from the post now