How to add multiple emails at once in a GlideList User field ?

JérômeM
Tera Contributor

Hello
I would like to have the possiblity to add multiple email addresses (coma-separated) at once in a GlideList field, the Watch List field as example.
Is it something someone got an idea ? I'm trying since a few days without success...

JrmeM_0-1741010922291.png



Enterring emails one by one works, but I would like to be able to do this with multiple.

Thanks
Jérôme

8 REPLIES 8

J Siva
Tera Sage

Hi @JérômeM 

There's no OOB approach to add all the recipients at a time. However you can have a server script in place to add the recipient email ids or have one custom string type field where you can padte the comma separated mail IDs and one BR to populate the receipt list from the custom field to OOB user field.

Regards,

Siva

Isn't it possible to interact with the email part of the watch list OOB field with a client script ? I tried but didn't manage to get it work. 

Nope. It's not achievable only via client script.

Do you have an idea of a client script that can do this ?
Tried with this, but no luck

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue === '') {
        return;
    }
    var emails = newValue.split(/[;,]+/); // Séparer les emails par virgules ou points-virgules
    var validEmails = [];
    emails.forEach(function(email) {
        email = email.trim();
        if (email && validateEmail(email)) {
            validEmails.push(email);
        }
    });
    g_form.setValue('watch_list', validEmails.join(','));
}

function validateEmail(email) {
    var re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
    return re.test(email);
}