logo

NJP

Post your script with formatting

Import · Jul 28, 2020 · article

If you're asking a coding question and pasting in script this is a must

Use the {;} button, up there

function onLoad() {
    var a = g_form.getValue('u_system_type');
    if (a == 'Live'){
        var b=g_form.getControl('u_system_type');
        b.style.backgroundColor="cornflowerblue";
        b.style.color="white";
            }
    else {
        var e = g_form.getControl('u_system_type');
        e.style.backgroundColor="white";
        e.style.color="black";
            }
    }

That way we keep some formatting, remember to select the language and to note the formatting only shows when saving

View original source

https://www.servicenow.com/community/developer-articles/post-your-script-with-formatting/ta-p/2321842