Notifications

1737 views

Description

On Service Portal the setValue function does not change a variable when combined with showFieldMsg or showErrorBox, when the onChange client script variable is the one having its value set and messages displayed.

The issue occurs when there are multiple g_form methods/functions run on the same field in an onChange catalog client script. 

Steps to Reproduce

  1. On a catalog item create a new variable set
    2. Add a single line text variable to the VS (field1)
    3. Add a second single line text variable to the VS (field2)
    4. Add an onChange Catalog client script to the VS on field2
    5. Enter in the following script (regex condition removed for troubleshooting)
    g_form.setValue('field1','555');
    g_form.setValue('field2','777');
    //g_form.showFieldMsg('field2',"Please enter a valid integer");
    //g_form.showErrorBox('field2',"Please enter a valid integer");
    6. Open the form in Portal
    7. Enter data in field1 and field2 then lose focus and both fields will change
    8. Uncomment the ShowFieldMsg and repeat step 7 -

Actual behavior:

field2 value will not change. field message can be seen

Expected behavior:

field2 value changes. field message can be seen

Workaround

This issue has been fixed in Madrid.  If you cannot upgrade to Madrid at this time here is an alternative workaround:

This workaround does not require that you re-write the catalog client scripts, instead, it restores the functionality that that should work London.

  1. Navigate to System UI > UI Scripts in the platform.
  2. Create a new UI script with name "SpFormFieldDirective" 
    UI type - Mobile/Service Portal 
    Active - true 
    Script - Copy/Paste the content of file spFormFielddirective.txt (attached) 
    submit
  3. Create new UI scripts with name as "SpModelDirective" 
    UI type - Mobile/Service Portal 
    Active - true 
    Script - Copy/Paste the content of file spModeldirective.txt (attached) 
    submit
  4. Create new UI scripts with name as "SpGlideFormFactory" 
    UI type - Mobile/Service Portal 
    Active - true 
    Script - Copy/Paste the content of file glideFormFactory.txt (attached) 
    submit
  5. Now Filter navigator type in "sp_widget.list" open widget with the name "SC Catalog Item"
  6. Add a new dependency, provide any name.
  7. Open that dependency you just created and create a new "js includes" record with name "SpFormFieldDirective" 
    source - UI script 
    UI Script - select script created in step 2
  8. create a new "js includes" record with name "SpModelDirective" 
    source - UI script 
    UI Script - select script created in step 3
  9. create a new "js includes" record with name "SpGlideFormFactory" 
    source - UI script 
    UI Script - select script created in step 4 

    Once all these steps are complete, this should fix the issue you are experiencing.

 


Related Problem: PRB1306928

Seen In

London
London Patch 3

Fixed In

Madrid

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-07-10 16:37:11
Published:2019-06-14
glideFormFactory.txtspFormFielddirective.txtspModeldirective.txt