Setting UI Action Color

GuiReis
Tera Contributor

How do I set the color for UI Action buttons?
I do not see an option for it on the UI Action.

I tried Client Scripts but I see 2 problems with them:
 - They run before the page loads, so the button objects do not exist yet
 - They do not have access to DOM, document or any object in the page.

I tried this solution and variants but nothing worked.
https://servicenowguru.com/scripting/client-scripts-scripting/change-form-button-color/
I always get this error when using console.log(e) inside of catch(e){}:
TypeError: $$ is not a function

1 ACCEPTED SOLUTION

Maharshi Chatte
Kilo Guru

Hi ,

You can change the colour from form style - to destructive(red) or green . If it not visible on your UI action form then first try to add the "form style" field from the form designer and then the field will be visible where you can change the colour

View solution in original post

6 REPLIES 6

Community Alums
Not applicable

Hi @Guiherme ,

No need of Client scripts if you just want to change the color of your UI Action button on the form...no client script in necessary. There's a field called "Form style" as seen in your screenshot and contains a few styles already OOB. One is "Destructive" which is red...so set your reject button to that style and that one is done.

For the Green version...you'd have to create that...please see this thread and specifically look for Chuck's response that gives details on how to add other colors: https://community.servicenow.com/community?id=community_question&sys_id=d2494725db5cdbc01dcaf3231f96...

Example :

UI Action for approve:

image

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

 

find_real_file.png

Where is that???

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you need to ensure Isolate Script field is set to false for your client script to allow jquery to run

find_real_file.png

Regards
Ankur

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

I did Isolate the script and it didn't work.