How do i add an array to a field ,separated by comma

Chinmayee1
Giga Contributor

Hi,

I need to add an array of values  to a field separated by , comma.i m getting only one value in that but not all the values.

for example array = {1,2,3}

field A should show me 1,2,3 but it shows me only 2 

if i assign the same to a variable and check in the logs , it shows me 1,2,3 .but in the field only 2.

Can anyone please advise ?

19 REPLIES 19

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

First, {} is an object while [] is an array. But the important question here is what type of field do you want to put that "array" in? If it's a string field you can just type "1,2,3" and you are done.

 

//Göran

manjusha
Kilo Guru
Hi, var arr ={2,3,4}. Please convert your array to string. As below. var arrElement = are.toString(); Then assign arrElement to your field. Please mark this answer as correct and helpful based on impact. Regards, Manjusha Bangale

It shows me native array in the field and not the values.

Can you please paste in the code here instead so it's easier to help out. Still wonder thou what type of field the current.u_hostname is.

 

//Göran