- 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,596 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-12-2016 06:15 AM
Please give us some more details. The article should help you. Please let us know where you are stuck. Screenshots and code will be helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 06:18 AM
In the Article they have used Jquery. you need to use the exact label name of the button no system name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2016 06:18 AM
can you share what you have tried that isnt working?
Make sure you are setting the "Action Name" on your UI Action and then calling it in the client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2016 12:42 AM
Hi,
I tried all the options shared to me but it doesn't seem to work.
finally I tried the below code it works when I am using JavaScript Editor and not on Client script.
function onLoad() {
//Type appropriate comment here, and begin script below
alert('hi');
var outage = document.getElementsByTagName('button');
for(i=0;i<outage.length;i++)
{
if(outage[i].innerHTML.indexOf('Approve') > -1)
{
// alert("Button color");
outage[i].style.backgroundColor = "#00ff00";
}
}
}