Auto scroll Form to bottom after clicking a ui action

Sai kumar123
Tera Expert

Hi , i had a requirement, where it is asked to create ui action, when clicked on it it should open another record form but it should be scrolled down when opened, is it even possible to auto scroll the form using script

3 REPLIES 3

kaushal_snow
Mega Sage

Hi @Sai kumar123 ,

 

Add this code within your UI Action,

 

action.setRedirectURL(current);
setTimeout(function() {
window.$j(document).scrollTop(document.body.scrollHeight);
}, 500);


Additionally, you can check the below link:

 

https://www.servicenow.com/community/servicenow-ai-platform-forum/scroll-down-to-related-list-ui-act...

 

Try this once and let me know. If you find this helpful, please accept this as a solution and hit the helpful button..

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

Sai kumar123
Tera Expert

Hi kaushal, i had implemented the code and also researched but nothing worked there and as we all know DOM Manipulations are not advisable , i had came up with an alternative in my mind lets hope it works, anyway thank you for suggesting.

Ankur Bawiskar
Tera Patron
Tera Patron

@Sai kumar123 

I don't think this is possible without DOM manipulation and DOM is not recommended practice.

Also I believe it's not a good user experience to take user directly down after auto scrolling. 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader