List Collector's right slush bucket is not populating with onLoad Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2020 03:14 PM
Using an onLoad client script, I want to auto-populate the right slush bucket of a List Collector type variable with a value from left slush bucket on a catalog form. A solution was provided and accepted in the post below. I am using g_form.setValue('list name', sys_id) as suggested...but t does not work for me. Any idea what could be wrong?
function onLoad() {
var employee_name = g_form.getValue('form_variable_name referencing sys_user');
if (employee_name != ""){
g_form.setValue('list_name referencing sys_user', employee_name);
}
BTW, the employee does exist in the left slush bucket.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2020 08:07 AM
it was false already by default, perhaps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2020 09:26 PM
I think you need to set the display value as well:
function onLoad() {
var employee_name = g_form.getValue('form_variable_name referencing sys_user');
var employee_display = g_form.getDisplayBox('form_variable_name referencing sys_user').value;
if (employee_name != ""){
g_form.setValue('list_name referencing sys_user', employee_name, employee_display );
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2020 08:06 AM
this did not work either

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2020 06:18 PM
What part didn't work?
Can you add a log statement?
var employee_name = g_form.getValue('form_variable_name referencing sys_user');
var employee_display = g_form.getDisplayBox('form_variable_name referencing sys_user').value;
// Check that we are getting the display value
jslog("employee_display: " + employee_display );
if (employee_name != ""){
g_form.setValue('list_name referencing sys_user', employee_name, employee_display );
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 11:58 AM
Many thanks for the follow up, Paul. I added the log statement and it correctly logged the value for employee_display. I believe there is some issue for onLoad client script with a List-Collector variable type. It states in the docs below:
https://docs.servicenow.com/bundle/paris-servicenow-platform/page/product/service-catalog-management/reference/r_VariableTypes.html#d233535e663
"When the glide_list attribute is not true, you can only set the value that is visible in the Available list using the g_form.setValue() function. This functionality is not applicable when the setValue() function is called onLoad."
So, I have now moved on to setting the attribute "glide_list" for the variable and things are working.