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.
Adding an existing option to a Select Box variable via a Catalog Client Script displays an empty choice in list dropdown - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • Adding an existing option to a Select Box variable via a Catalog Client Script displays an empty choice in list dropdown
KB0683754

Adding an existing option to a Select Box variable via a Catalog Client Script displays an empty choice in list dropdown


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

Description

Reproducible in K, not an issue in I and J.

Steps to Reproduce

1 - In a Kingston instance, open an sc_cat_item record, i.e. Access:
<instancename>/nav_to.do?uri=pc_software_cat_item.do?sys_id=039c516237b1300054b6a3549dbe5dfc

2 - Scroll down to 'Variables' related list and click New:
type: Select Box
question: q1
name: q1

3 - Click Save and stay at q1 Variable form

4 - Scroll down to 'Question Choices' related list and create choices as below;
text / value / order
---------------------------
one / one / 100
two / two / 200
three / three/ 300

5 - Go back to Access catalog item. Scroll down to 'Catalog Client Scripts' related list. Click New
type: onLoad
script:
function onLoad() {
g_form.addOption('q1','two','two');
}

6 - Click Submit

7 - Go to Access catalog item once more. Click Try It from the form header section.
<instancename>/nav_to.do?uri=/com.glideapp.servicecatalog_cat_item_view.do%3Fv%3D1%26sysparm_id%3D039c516237b1300054b6a3549dbe5dfc

8 - Check the q1's options. Notice the dropdown list shows the following:
-one
-three
-<blank>
-two

Workaround

Modify the Catalog Client Script to check if the option exists in the options list before trying to add it to the list.

i.e.:

if (!g_form.getOption('q1', 'two')) {
    g_form.addOption('q1', 'two', 'two');
}


Related Problem: PRB1251363

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.