Comma in names in List Collector not being displayed properly

Community Alums
Not applicable

Hi Team,

 

We have a List collector field and we are trying to populate the Account names which have comma at places, this is treating it as another values and making it split.

How to correct this behaviour

 

Below is the list of account names with commas

Ankur20_0-1726213618612.png

 

When I try to fetch using OnChange Client script from script include it treats comma as separate as below:

Ankur20_1-1726213683203.png

Below is my script and I am trying to comma as string but still it is not working

comma_add = accounts.replace(/,/g,',');
                                gs.info('comma_addis:' + comma_add);
                                arr.push(comma_add);

 

if (type == 10) {

                        var add = new GlideRecord('customer_account');
                        add.addEncodedQuery('account_pathSTARTSWITH' + con_rel.account.account_path + '^account_parentISNOTEMPTY');
                        add.query();
                        while (add.next()) {
                            var addresp = new GlideRecord('sn_customerservice_contact_relationship');
                            addresp.addQuery('contact', con_rel.sys_id.toString());
                            addresp.addQuery('company', add.sys_id.toString());
                            addresp.addQuery('u_authority_role', res);
                            addresp.query();
                            if (!addresp.next()) {
                                accounts = add.name.getDisplayValue();
                                //gs.info('accounts:'+accounts);
                                comma_add = accounts.replace(/,/g,',');
                                gs.info('comma_addis:' + comma_add);
                                arr.push(comma_add);

 

 Please help?

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Community Alums Instead of pushing the account names in array, you can choose to push the sys_ids and populate these sys_ids on your list collector using client script. 

View solution in original post

1 REPLY 1

Sandeep Rajput
Tera Patron
Tera Patron

@Community Alums Instead of pushing the account names in array, you can choose to push the sys_ids and populate these sys_ids on your list collector using client script.