How to keep the page scroll position even after refreshing pages (both Classic UI and Portal)?

Aki18
Tera Contributor

When refreshing page (both Classic UI and Portal), the page scroll position is lost and moved to the top position of the page, which is very inconvenient...
Is there any way to keep the scroll position even after refreshing Classic UI and Portal pages?

For example, in portal page, is there any method to define that function somewhere? (Maybe in the Client controller of the widget?)


Best Regards,
Aki

1 ACCEPTED SOLUTION

Markus Kraus
Kilo Sage

 

I thought this is quite an interesting go because especially list count = 100 or with forms that have a huge activity log you tend to scroll a lot.

Also when editing huge script includes you wouldn't need to scroll a lot (note: this is currently not implemented, but will probably be in a future version).

 

So what you have to do is fork the following repository and then open up the target instance's studio and select "Import From Source Control" (where you specify the newly forked repository):

https://github.com/kr4uzi/ServiceNow-Scroll-Restore

View solution in original post

15 REPLIES 15

Markus Kraus
Kilo Sage

 

I thought this is quite an interesting go because especially list count = 100 or with forms that have a huge activity log you tend to scroll a lot.

Also when editing huge script includes you wouldn't need to scroll a lot (note: this is currently not implemented, but will probably be in a future version).

 

So what you have to do is fork the following repository and then open up the target instance's studio and select "Import From Source Control" (where you specify the newly forked repository):

https://github.com/kr4uzi/ServiceNow-Scroll-Restore

Hi @Markus Kraus ,

Thank you again for working on it as well as my previous post.

Actually, I'm new to GitHub, but I think I could fork the repo and import your application to my instance as below. However, could you let me know what the next step is?

 

Aki18_0-1687266803215.png

 

Nothing actually. The scroll positions should be saved now.

Note: I plan to work a little bit on this, so you need to regularly "Sync" your fork (GitHub) and then "apply remote changes" (ServiceNow Instance: Studio > Source Control).

Also note that currently the scroll position is not saved if you do not reload the window, but instead use the "reload form" UI Action.

Hi @Markus Kraus ,

Thank you for working on it. 

> Nothing actually. The scroll positions should be saved now.

 

I just imported your application, but the scroll position is not kept after refreshing the browser (both Classic UI and Portal)... Is it working in your environment?