Notifications

133 views

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

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-08-15 21:08:21
Published:2019-08-16
sys_script_client_87125cf2db527b00f943168139961956.xmlsys_script_include_2ec0dcb2db527b00f94316813996193b.xml