The CreatorCon Call for Content is officially open! Get started here.

How to Copy list collector values to string field using BR

AnilM99
Tera Expert

Hi Team,

 

How to Copy List Collector values to String field using BR 

When the List collector values changes copy new values to string field in sys_user_group Table

 

AnilM99_0-1702641867342.png

 

Thank you,

Anil!

 

4 REPLIES 4

Brad Bowman
Kilo Patron
Kilo Patron

If you truly mean List Collector values, then it's just

 current.new_field_name = current.list_field_name;

You'll find that the value of a List Collector field is a comma-separated list of sys_ids for the referenced table.

Shruti
Mega Sage
Mega Sage

Hi,

Create a before update business rule when list collector value changes

Write below in advanced script 

current.<string_field_name> =  current.<list_collector_field_name>.getDisplayValue();

Ankur Bawiskar
Tera Patron
Tera Patron

@AnilM99 

you can use before insert/update BR

Script will be like this

current.setValue('fieldName', current.listField.getDisplayValue());

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Shamma Negi
Kilo Sage
Kilo Sage
 current.<string_field_name>= current.<list_variable_name>;

It will give you the sys_ids in comma separated If you wnat name then look below:

 

var sys_ids = current.<list_field_name>;

var arr = [];

var ids = sys_ids.split(",");

for(var i=0;i<ids.length;i++)

{

var gru = new GlideRecord("sys_user"):

gru.addQuery("sys_id", ids[i]);

gru.query();

if(gru.next())

{

arr.push(gru.full_name);

}

 

var final = arr.toString();

 

current.<list_field> = final;

 

}

 

 

Regards,

Shamma

 

Regards,Shamma Negi