cmcclendon
Mega Guru

Greetings all. I came across a simple way to colorize those dull, dreary UI Actions that can sometimes be hard to see in the form header. For this example, I'm using a Chrome browser with a submitted change request that is in a state of New.

  1. Load an existing change request that is in the New state and open the browser's element inspector (CTRL-SHIFT-C).
  2. Hover over the "Request Approval" button in the header and click, then copy the element 's ID to the clipboard.
  3. Create a UI Formatter and a UI Macro and name them something relevant. Reference the wiki for details.
  4. find_real_file.png
  5. find_real_file.png
  6. Open the change request form in the designer and place the formatter anywhere on the page as it will have no elements or space. I placed mine on the last row of the second column.
  7. Creating the style in the UI Macro serves as an override for the button element as it loaded after the UI Action. Make sure the name of the element referenced in the style tag is the same as the one we copied to the clipboard in Step 2.
  8. find_real_file.png

UPDATE: Here's an update that simplifies this even more. I've learned that the element id's referenced in the style tags are actually a property of the UI Action, called the "Action name".   If this field is left blank, then you will get a sys_id and you will not be able to reference it from the code. I went in and gave an existing UI Action on the Change form a name and now I don't even need to inspect elements, as I did in the previous post, I can just insert the Action name into the style tag.

find_real_file.png

Here's my new UI Macro/Formatter code:

find_real_file.png

Enjoy!

This document was generated from the following discussion: Styling UI Action Buttons

Comments
Chuck Tomasi
Tera Patron

Hey Chris. Good stuff. Have you tried this with a scoped app?


cmcclendon
Mega Guru

Hey Chuck. The answer is yes, it works fine in a scoped app.



find_real_file.png



Enjoy!


Chuck Tomasi
Tera Patron

Thanks Chris. I'll have to keep tinkering. I must have something wrong somewhere in my scoped app UI macro or formatter. Hopefully it's something simple I've overlooked after hours and hours of developing other stuff.



find_real_file.png


find_real_file.png


find_real_file.png


cmcclendon
Mega Guru

Try removing the colons between the name and the params.


Chuck Tomasi
Tera Patron

Thanks Chris! I knew it was something simple. I've been doing too many script includes that I forgot my CSS syntax! Removing the colons worked perfectly.


Rick Forristall
Tera Guru

This is great stuff!



One challenge I see is the button at the bottom of the form. For some reason the font-color attribute isn't working. See image: Any ideas?



Top of Form: White font


find_real_file.png



Bottom of form: black font:


find_real_file.png



My macro:


find_real_file.png


Rick Forristall
Tera Guru

Never mind - I saw my mistake in the css.



font: white should be color: white



doh!


cmcclendon
Mega Guru

UPDATE: I'm using the same technique for my update set picker by changing the width property. I also switched from using the foreground/background colors to simply adding a slight border, which makes it appear more like a 3D button. So use the same style section, just find the id's of the different elements you want to change. This techniques migrated from Geneva to Jakarta with no hiccups.



Capture-chris-png.PNG


reganr
Tera Contributor

Hello Chris,

Do you have an updated example / consolidated instructions for how to do the background highlight border?

Does this still work in Orlando/Paris?

Does it work in conjunction with the form style field?

 

xiaix
Tera Guru

Brilliant.  Thank you for explaining that this can be done via UI Macro's using XML/Jelly. Soooooo much better than manipulating the DOM with an onLoad client script 🙂

CezaryBasta
Tera Guru

Very inspiring article! You can in fact do much more styling in the backend form, even to the extent of applying external CSS. I wrote a post about it here.

CezaryBasta1_0-1699614094079.png

 

Version history
Last update:
‎03-02-2017 06:36 AM
Updated by: