Splitting values from list collector
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2023 11:01 AM - edited ‎02-16-2023 12:32 PM
I have a list collector on a Catalog Item in the Portal, it collects from the user table. I'm trying to use an onSubmit Catalog Client script to collect the values from that list collector and separate them, printing out values to another Multi Line Text field.
This works in the ITIL view but not in Portal. From the Portal I get a blank variable
EDIT:
This works from the Portal as an onChange script (on change of u_select_employee_names) not onSubmit
However. When on onChange is selected and I test it in IS view, it duplicates values into the 'u_email' field
function onSubmit() {
var employeesValue = g_form.getValue("u_select_employee_names"); //list collector
var employeesArray = employeesValue.split(",");
for (var i = 0; i < employeesArray.length; i++) {
var user = new GlideRecord("sys_user");
user.addQuery("sys_id", employeesArray[i]);
user.query();
if (user.next()) {
var emailData = g_form.getValue("u_email");
g_form.setValue("u_email", emailData + user.email + "; ");
}
}
return true;
}
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2023 11:15 AM
Hello Russell,
In Catalog Client Script, Select UI Type 'All'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2023 11:40 AM
@Prasad Dhumalit is already set to All, I had checked that earlier.