showFieldMsg - scrollForm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 08:15 AM
Hello,
I would like to share the issue/solution we faced in form focus.
Issue:
While creating an incident, the form does not focusing the first editable field in the form. Instead it is navigating to our custom field which is at the bottom of one of the form sections.
Analysis:
ServiceNow Wiki URL: Display Field Messages - ServiceNow Wiki
When a field message is displayed on a form on load, the form will scroll to ensure that the field message is visible, ensuring that users will not miss a field message because it was off the screen.
A global property (glide.ui.scroll_to_message_field) is now available that controls automatic message scrolling when the form field is offscreen (scrolls the form to the control or field).
Solution:
As wiki says, we found an on-load client script which is populating the error info message to our custom field. Since the change of the global property (glide.ui.scroll_to_message_field) may affect globally, we have just added the 4th parameter as "false" in g_form.showFieldMsg() method like below.
g_form.showFieldMsg('u_custom_field_name','Whatever message you wants to display','error', false);
Since the 4th parameter is optional, most of us left that as it is. Set this to false to prevent scrolling to the field message offscreen.
Thanks,
Krishna
- 2,912 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2019 04:39 AM
Very useful thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2020 01:38 AM
thanks krishna!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2020 10:30 AM
Great thanks 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2021 07:59 AM
Thanks for sharing...