logo

NJP

Adding Color To form UI action Button

Import · Sep 24, 2019 · article

Name :Resolve

Action Name :resolve_incident

client :check

changeButtonColor('resolve_incident', 'Brown');//Action name or sys_id('resolve_incident') of button and provide color to the button(Brown)

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){}

}

Note : New client-scripts are run in strict mode, with direct DOM access disabled. Access to jQuery, prototype and the window object are likewise disabled. To disable this on a per-script basis, configure this form and add the "Isolate script" field.

GLOBALLY ---> To disable this feature for all new globally-scoped client-side scripts set the system property "glide.script.block.client.globals" to false.

NON GLOBALLY-----> just configure the ISOLATED SCRIPT FEILD ON UI ACTION BUTTON FORM AND UNCHECK IT

Labels:

image

View original source

https://www.servicenow.com/community/itsm-articles/adding-color-to-form-ui-action-button/ta-p/2312503