Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
g_form.showFieldMsg is not setting focus to the Additional Comments box in activity stream - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • g_form.showFieldMsg is not setting focus to the Additional Comments box in activity stream
KB0685119

g_form.showFieldMsg is not setting focus to the Additional Comments box in activity stream


1147 Views Last updated : Apr 7, 2024 public Copy Permalink
KB Summary by Now Assist

Description

g_form.showFieldMsg is not setting focus to the Additional Comments box in Helsinki. By using the below function (eg on a Incident form):
g_form.showFieldMsg('comments','No Focus on Comments box','error',true);

The Comments field should get the focus, which instead seems to be placed on top of the page.
The fourth parameter (true) is actually the [code]<strong>scrollForm</strong>[/code] option and, when set to true, should get focus to the field where the showFieldMsg function is applying (Comments in this case). The issue does not occur on other fields like Short Description or reference fields.

 

Steps to Reproduce

 

1 - Run the below function somewhere in a task form:
 g_form.showFieldMsg('comments','No Focus on Comments box','error',true);
 
2 - Import the attached UI Action code (a button named "test INT3033882" in the Incident form).
 
3 - Scroll the page in order not to have the comments shown on the screen. Notice the focus will be placed on top of the page.

Try running the same function for short_description instead of comments to observe the correct behaviour.
 

Workaround

Helsinki has resolved the related problem PRB657182 - g_form.showFieldMsg does not work with the Activity Formatter in UI16.

The below function has been provided as workaround for the focus issue (using that function you would have to set the scrollForm option of g_form.showFieldMsg to false ):

function getFocusToComments(){
	var com = gel("activity-stream-textarea");
	if (com){
		com.focus();
		return;
	}
	com = gel("activity-stream-comments-textarea");
	if (com)
		com.focus();
	return;
}


Related Problem: PRB712506

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.