Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Onload Client Script not working in Agent workspace

Michael_Nash
Tera Contributor

I have the below onload Client script and is working perfectly in UI16 however i need the banner to also show in Agent Workspace.

 

function onLoad() {
    var isEvTruck = g_form.getValue('u_ev_truck');
    if (isEvTruck === 'true') { // Check if the value is a string 'true'
        // Create a banner element
        var banner = document.createElement('div');
        banner.style.backgroundColor = 'lightgreen';
        banner.style.color = 'black'; // You can adjust the text color
        banner.style.padding = '10px';
        banner.style.fontWeight = 'bold';
        banner.style.textAlign = 'center';
        banner.innerText = 'This is an EV Truck!';

        // Insert the banner at the top of the form
        var formHeader = g_form.getFormElement().firstChild;
        g_form.getFormElement().insertBefore(banner, formHeader);
    }
}
 
Michael_Nash_0-1698398364755.png

 

6 REPLIES 6

have you found a solution to this? i am also facing the same problem

@ran321 
Send me the screen shot of the script