glass of cold beverage on white background

I try to stay on top of things in ServiceNow world. To make this task easier, I have subscribed to developer articles updates from the community. And yes, it’s worth it. There are couple of gems there that deserve more attention. They inspire me to think outside of the box or they challenge me to verify or explain and understand why they work.

This post is inspired by that article. Author only shows how to change the ui action background color. But after reading it, my mind was like wow, if this is possible, then why I couldn’t change some inputs? Or maybe even load external CSS library? As it turns out, it is not only possible, but pretty simple and non-disturbing to other features of the platform.

Quick and dirty result

What I was able to achieve pretty quickly (about an hour, including research) still requires some work, but it’s cosmetic touches, really:

Everything works as before – the selects, lookups, buttons, … What was updated is just the CSS.

How to?

That’s really simple, just follow the guide from the original article:

  • Create a UI Macro
  • Create a UI Formatter using this UI Macro
  • Add UI Formatter on the form

And that’s it! Now you only have to adjust the content of the UI Macro to whatever you like.


To achieve the result displayed above, I used materialize CSS library. You can choose anything you like, just remember that you have to be able to link it with external URL from your UI Macro with the <link> or <script> tags.

You can see the big difference on the form even after only loading the external CSS and JS files:

In this particular case, there are only select and textarea inputs not yet affected. They both require class updates (out of the box they have form-control class, this has to be replaced). Additionally, specifically in materialize, select inputs have to be initialized after the DOM content is loaded.

So, after implementing the class updates and inputs initialization you will almost get my final result. You may have noticed I also updated the navigation buttons. Doing this is simple once you learn that their id attribute is the same as UI Action’s Action name value.

My final UI Macro looks like that:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	<link rel="stylesheet" href=""></link>
	<link href="" rel="stylesheet"></link>
	<script src=""></script>
		#formBtn { background-color: orange;}
	<script type="text/javascript">
		document.getElementById('create_collab_chat').innerHTML = '<i class="material-icons" style="line-height: unset">chat_bubble_outline</i>';

		document.addEventListener('DOMContentLoaded', function() {
			var selects = document.querySelectorAll('select');
			var textAreas = document.querySelectorAll('textarea');
			var instances = M.FormSelect.init(selects, options);

			selects.forEach(function(sel) {


Now you will have no excuse when customer forces you to apply corporate theming across whole instance!

Leave a Reply

Your email address will not be published. Required fields are marked *