We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

UI Action scrolls to Resolution section only if section was opened earlier

Sachin_Nasa
Tera Guru

Hi ServiceNow Community,

I have a custom UI Action button in the banner frame of the Incident form to scroll the user to the Resolution Information section without refreshing the page.

Current behavior:

  • If the Resolution Information section is manually opened once, then clicking the button:

    • Makes Resolution Code and Resolution Notes mandatory

    • Scrolls correctly to the section
      (This works)

  • If the section was not opened earlier (default form load):

    • Clicking the button does not scrolls the page

    • Because the Resolution Information section remains collapsed, so the fields are not visible

The section is part of the 3rd form section, which is configured like that.

Question:
Is there a supported way to programmatically expand a collapsed form section (UI16) when clicking a UI Action, so the Resolution section becomes visible before even its in 3rd section?

Thanks in advance!


Thanks & Regards,
Sachin Narayanasamy
2 REPLIES 2

ZubairQ
Tera Contributor

collapsed section is not in the DOM, so scrolling won’t work until you expand it first.

Use g_form.setSectionDisplay() in your client UI Action, then scroll.

 

Always expand the section first. Then scroll after a small delay. This is supported and upgrade-safe in UI16

 

abbasshaik4
Tera Sage

Hello @Sachin_Nasa,

 

Please refer to the below link:
https://www.servicenow.com/community/developer-forum/how-can-i-collapse-expand-a-form-section-via-sc...

 

If it is helpful, please mark it as helpful and accept the correct solution; by referring to this solution in the future, it will be helpful to them.

 

Thanks & Regards,

Abbas Shaik