Set Background image on form

alexcharleswort
Tera Expert

Hi Everyone,

I have a need to set my company's logo as a background on the form of a custom table. I'm not entirely sure where to begin with this one. I imagine doing something like this but not entirely sure where to put it? UI Script on the page? My attempts at that failed.

Any help would be greatly appreciated!

Thanks all!

1 ACCEPTED SOLUTION

Use this for background size



function onLoad() {


    //Type appropriate comment here, and begin script below


    document.body.style.backgroundImage = "url('10Things02a_v2.png')";


document.body.style.backgroundSize = 'cover';


}


View solution in original post

9 REPLIES 9

I just found that and it works super well. It just cut off the bottom part. I adjusted it just a little bit and this is my final script:



function onLoad() {


    //Type appropriate comment here, and begin script below


    document.body.style.backgroundImage = "url('staff_logo.jpg')";


    document.body.style.backgroundRepeat = "no-repeat";


document.body.style.backgroundSize = "100% 100%";


}



Thanks you guys for helping!! And so quickly! I know I'll be using this a ton!


I am done with the same but not changed not back ground

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Deepak Negi
Mega Sage
Mega Sage

Hi

 

Please follow my article to set background of the form

 

https://www.servicenow.com/community/developer-forum/from-bland-to-grand-decorating-servicenow-forms...

 

Mark correct/helpful if it helps

Hi,

yeah uhm...

 

I followed your little tutorial, frankly looks cool from what you showed, but for me the formatter just display the content of the UI Macro... You said to put the formatter on the page, but does it need to have a particular place for it?

 

I'm not sure what the content of the UI Macro does concretely. I inspected the element of the page to see what you were pointing at, '.scroll-touch' makes sense, but the rest doesn't for me. I will say though that I am doing this for a custom table, so maybe since the elements I have are different, the components are different from your UI Macro. 

But, if that is the case, can you please explain to me why it was important to specify the rest of elements?

I'm trying to understand how to change it so that mine works on the custom table I have. But for this I need to understand yours.

 

Thanks,

Darius

Hi Darius

 

Since SN introduced Next experience as well, so the UI macro has all the classes being used in the Native UI as well as the Next Exp. So if you are inspecting in one of the UI you may not see the other classes. Hope it makes sense!