populating list collector variables with a client catalog script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 09:39 AM
I have a catalog item with multiple list collector variables and regular variables. I am trying to create a defined set of variable values to be populated automatically when the specific profile is selected. I am using catalog client script, based on information I have gleaned from the forums, but the fields are not populating. I have, (I believe) , set the list collection variable attribute to 'glide_list'
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var profileObj = g_form.getValue(newValue,'set_profile_selection');
//Basic AP Accountant Role
if (profObj == 'Accounting - AP Accountant') {
g_form.setValue('asset_management_roles', 'f04af62fdb7f4110589be525ca961973');
g_form.setValue('business_objects_roles', 'a3d60be7db338110589be525ca9619f9,d1578fe7db338110589be525ca9619e6, f2b847abdb338110589be525ca9619b1');
g_form.setValue('purchasing_roles', '132c4dc0db8c9510589be525ca9619d6');
g_form.setValue('accounts_payable__roles', '3e3b0b23db738110589be525ca961946,696c8f2bdb738110589be525ca961973,db1e4723dbb38110589be525ca96199a,3a3e47efdb738110589be525ca96198a,34dec7efdb738110589be525ca961927');
return;
}
}
Any help would be appreciated
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 09:46 AM
You are using hard coded sys_ids to populated the list which I believe is not the best practice.
Nevertheless, your logic for populating the script looks good, but I believe the way you are fetching the value for "set_profile_selection" is an issue, also you are saving that into a field profileObj but in if condition you are checking against profObj, which isn't same.
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 10:25 AM
You have a "return" as the last line of the script. This is telling the script to do nothing, just like it is in the "isLoading" check.
Remove it and retest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 11:06 AM
Good catch on the variable name; unfortunately, it didn't change anything. Also removing the return statement did not affect a change.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 11:19 AM
I am assuming " 'Accounting - AP Accountant'" this is a choice field, for comparison, make sure you are using the backend value.
And it is a choice field right?
Also try to put alert inside if block to check whether your script going inside the condition or not
Aman Kumar