Build information: Jakarta Patch 1 hotfix 1, Kingston

After upgrading to Jakarta or Kingston, sn-record-picker with multiple= "true" is throwing a JavaScript error stating "scope.field.value.split is not a function". 

Sample code: 

<sn-record-picker field="watch_list" 

Note: This only happens when the initial selection is empty.


Steps to Reproduce

1. Log in to any Kingston/Jakarta instance
2. Import the Watchlist widget on the demo instance.
3. Add the widget to the ticket form on Service Portal.
4. Open an incident on Service Portal.
5. Navigate to the ticket form.
6. Open the browser inspect -> console - Observe that there's no error
7. Add a user (Abel Tuter) to the watch list - Notice the user is added successfully

8. Remove the user from the watchlist
9. Navigate to the same ticket form on Service Portal(Make sure the watchlist is empty).
10. Open the browser inspect -> console.
11. Try to add a user (Abel Tuter) to the watch list.
Notice the following error in console log and the user cannot be added to the watchlist.

Console log:

Uncaught TypeError: scope.field.value.split is not a function
at HTMLInputElement.onSelecting (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:29991)
at HTMLInputElement.dispatch (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:2898)
at HTMLInputElement.elemData.handle (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:2689)
at Object.trigger (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:2846)
at HTMLInputElement.<anonymous> (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:3243)
at Function.each (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:215)
at jQuery.fn.init.each (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:59)
at jQuery.fn.init.trigger (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:3242)
at constructor.triggerSelect (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:49365)
at constructor.onSelect (js_includes_sp.jsx?v=07-16-2017_1250&lp=Wed_Aug_02_23_50_30_PDT_2017&c=4_75:50702 


In the server script for that custom widget

change this: 
data.displayValue = dV == '' ? [] : dV; 
data.value = sV == null ? [] : sV; 

to this: 
data.displayValue = dV == '' ? "" : dV; 
data.value = sV == null ? "" : sV; 

Related Problem: PRB1116155

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-09-05 04:57:54