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.
How to put focus on any variables for a catalog item/record producer when the form loads - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • How to put focus on any variables for a catalog item/record producer when the form loads
KB0755305

How to put focus on any variables for a catalog item/record producer when the form loads


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

Issue

Description

When a catalog item / record producer loads by default the focus will always be on the first variable per the system property "glide.ui.focus_first_element" (set to true).

This article will detain the steps that can be taken to make the focus be of any variable of choice on the form.

Procedure

1) Open the catalog item / record producer in question

2) Go to the related list "Catalog Client Scripts" and click New

3) Fill out the fields as necessary and make sure that Type is onLoad. 

4) On the script field paste the following code:

setTimeout(function(){
g_form.getElement('name_of_variable').focus();
}, 0);

 

*Replace 'name_of_variable' parameter with the actual name of the variable

5) Note that the above code is valid for non-reference type variables only. For reference type variables use the following code:

setTimeout(function(){
g_form.getElement('var_two').parentElement.lastElementChild.firstChild.focus();
}, 0);

6) Now load the catalog item / record producer again and the focus should be on the target variable

Applicable Versions

London and beyond

Additional Information

For normal fields on the table forms visit the following documentation for similar solution:

Modify form focus


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.