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.

How to set scrollTop on form in backend using Client Script

Radek Homola
Kilo Expert

Hi,

is there a way how to set scroll position (scrollTop) using client script on form?

The problem is that when I try to execute .scrollTop() on window object it returns undefined. Maybe it is connected with height of body – which is 100%.

 

Does somebody have an experience with setting scroll position inside the form iframe using DOM in client script?

Thanks

9 REPLIES 9

Harsh Vardhan
Giga Patron

are you using in ui page client script or form client script ? if you are on form client script,  did you set "isolate script" field as false ? 

can you add some screenshot ?

Radek Homola
Kilo Expert

Yes, I am able to do the DOM manipulation – Isolated field is unchecked. 

But firstly I was trying to set scrollTop from window object using console – it returned undefined.

Radek Homola
Kilo Expert

find_real_file.png

 

kindly have a look on below thread. it has mentioned an example. 

 

https://community.servicenow.com/community?id=community_question&sys_id=012057e5dbdcdbc01dcaf3231f96...