- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 09:45 PM
Can we have the approval buttons coloured like they currently are in production?
Fuji:
Calgary:
I think the red and the different green helps see the right option. There is a tendency to click the update button by mistake when they are all dark green.
#
Please help me Fuji also we need different colors.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 10:03 PM
Hi Naresh ,
Try this
You can use this script in an 'onLoad' client script on the table of your choice. This example should be used on the 'Approval' table.
function onLoad() {
//Change the color of the 'Approve' button to green
changeButtonColor('approve', '#00CC00');
//Change the color of the 'Reject' button to red
changeButtonColor('reject', '#CC0000');
}
function changeButtonColor(buttonID, backgroundColor) {
try{
//Find the button(s) by ID and change the background color
$$('button[id=' + buttonID + ']').each(function(elmt) {
elmt.style.backgroundColor = backgroundColor;
elmt.style.color = '#ffffff'; //make the button text white
});
}catch(e){}
}
Ref: Change the Color of Form Buttons - ServiceNow Guru for more details
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 10:03 PM
Hi Naresh ,
Try this
You can use this script in an 'onLoad' client script on the table of your choice. This example should be used on the 'Approval' table.
function onLoad() {
//Change the color of the 'Approve' button to green
changeButtonColor('approve', '#00CC00');
//Change the color of the 'Reject' button to red
changeButtonColor('reject', '#CC0000');
}
function changeButtonColor(buttonID, backgroundColor) {
try{
//Find the button(s) by ID and change the background color
$$('button[id=' + buttonID + ']').each(function(elmt) {
elmt.style.backgroundColor = backgroundColor;
elmt.style.color = '#ffffff'; //make the button text white
});
}catch(e){}
}
Ref: Change the Color of Form Buttons - ServiceNow Guru for more details
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 10:31 PM
As of now we have the below script, it is correct? please help me.
function onLoad() {
//Change the background color of the 'Reject' and 'Approve' buttons
//get all of the 'button' tag elements in the document
var refs = document.getElementsByTagName("button");
if (refs) {
for (var i=0; i < refs.length; i++) {
var ref = refs[i];
var inner = ref.innerHTML;
//Check for the button 'Name' value from the UI Action record
if (inner.indexOf('Reject') > -1){
//Change the color of the 'Reject' button to red
ref.style.backgroundColor = "ff0000";
}
if (inner.indexOf('Approve') > -1){
//Change the color of the 'Approve' button to green
ref.style.backgroundColor = "00CC00";
}
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 11:45 PM
Hi naresh,
Use Syed Farhan reference code from SNOW Guru its working for me so you can try that one
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 10:48 PM
Hi Naresh,
The coloring feature to UI Actions is not Out of the Box even in Calgary.
That must be customization. You need to look for the script which is adding colors to these buttons and find out why it is not working in Fuji.
Another example of why not to use DOM Manipulation.
Thanks
Srinivas