Splitting values from list collector

Russell Abbott
Kilo Sage

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!

2 REPLIES 2

Prasad Dhumal
Mega Sage
Mega Sage

Hello Russell,

In Catalog Client Script, Select UI Type 'All'

 

PrasadDhumal_0-1676574891527.png

@Prasad Dhumalit is already set to All, I had checked that earlier.