Multiple values store in one variable

Debarpita Basak
Giga Contributor

Hi All,

How i can store multiple values in one varible and join with comma , by current sys_id  i am getting two sysid  i want store two sys_id in one variable ?  

in ui action var sys_id = current.sys_id;// getting two sys_id want to join in one variable
var arr = [];

var SYSID = arr.join(',');
gs.addInfoMessage(SYSID);

1 ACCEPTED SOLUTION

@Debarpita Basak 

I am already responding on this thread.

So if you think I answered your original question of setting the number field with the list of RITMs selected then mark my response as correct and close this question.

Regards
Ankur

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

View solution in original post

25 REPLIES 25

Aman Singh_
Kilo Sage

Hi,

 

You can do something like.

var storeid='';
var storeid=storeid+','+current.sys_id;
gs.addInfoMessage(storeid);

mark Correct/helpful if applicable, thanks!!

Aman

thanks Aman for replying

it not working 

Actually i am trying to create a record task for multiple ritm that want to store multiple sys_id into task field , field type :list, thats why wants to store multiple sys_id in one varaible .

sendCustomEmail();
function sendCustomEmail() {

// var sys_id = current.sys_id;
// current.number= sys_id;

var storeid='';
var storeid=storeid+','+current.sys_id;
gs.addInfoMessage("deb" + storeid);


var url = 'sc_task.do';
action.setRedirectURL(url);
action.setReturnURL(current);

}

Anil Lande
Kilo Patron

Hi,

I'm curious to know how come current.sys_id is giving you two sys_is's?

 

Can you please share?

 

You can use 

var arr = [];

arr.push(current.sys_id.toString());

var SYSID = arr.join(',');

gs.addInfoMessage(SYSID);

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi Anil,

Actually i am trying to create a record task for multiple ritm that want to store multiple sys_id into task field , field type :list, thats why wants to store multiple sys_id in one varaible .

i have add one option"Send custom email" in ritm list page in available in selected rows like delete if i select multiple rom in ritm list it will open one task record and want to store multiple ritm sysid in that form

Kindly help me, I tried with your code not working for me attach the screenshot