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.
Agent workspace shows blank choice when choice field populated by AJAX call - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • Agent workspace shows blank choice when choice field populated by AJAX call
KB0756704

Agent workspace shows blank choice when choice field populated by AJAX call


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

Description

Agent workspace shows blank choice when choice field populated by AJAX call.

Steps to Reproduce

Required Plugins:

  1. Agent Workspace
  2. TSM Workspace
  3. State Flow

 

This issue affects the default "State" values added by auto-created Client Script from the Plugin "State Flow".

  1. Navigate to "sf_state_flow.do".
  2. Create two State Flow records. 

Table: incident 
Name: Incident - New to In Progress 
Starting state: New 
Ending state: In Progress 

Table: incident 
Name: Incident - New to Resolved 
Starting state: New 
Ending state:

3. Click to open one of the record created just now. 
4. Click the button "Create Client Script" on the form. 
5. The Client Script "incident state flow" is created automatically on the incident table. 
6. Change the UI Type of the Client Script "incident state flow" to all. 
7. Click to open one incident record with State "New" on the workspace. 
8. The Choice list of State becomes "New, In Progress and Resolved" and the current option is set to blank after the form is loaded. 

This issue happens when the Plugin "State Flow" is activated to restrict state options.

However, it can be reproduced by adding options by a generally Ajax call in a Client Script.

I just take "State" filed on the incident table as an example.

1. Log in as admin
2. Import "sys_script_include_2ec0dcb2db527b00f94316813996193b.xml" to created the Script Include "TestIncidentState".
This Script Include returns labels and values for options.
3. Import "sys_script_client_87125cf2db527b00f943168139961956.xml" to created the onLoad Client Script "Refresh State" on the incident table.
This Client Script calls the Script Include "TestIncidentState" to get all options then adds them to the State field.
4. Click to open one incident record on the platform view.
The State is "In Progress".
5. Open the same incident record on the workspace.

Expected behavior
The State is "In Progress".
Actual behavior
The State is blank.

Workaround

This is expected behavior and by design in all currently supported releases.

Using script 'g_form.setValue()' to set the default value.

For the Client Script created automatically by the Plugin "State Flow".

  1. Use var v_state = g_form.getValue('state') to get the current state value before 'g_form.clearOptions('state')';
  2. Add 'g_form.setValue('state', v_state)' after all options are added.

Related Problem: PRB1355346

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?

Attachments

Attachments

  • sys_script_client_87125cf2db527b00f943168139961956.xml
  • sys_script_include_2ec0dcb2db527b00f94316813996193b.xml

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.