I can't use the split function in a workflow script.

HugoFirst
Kilo Sage

The script stops executing on a the line which contains the split and the log shows a message "split is not a function".   What gives?

I've searched and found several examples where it appears to work for others.   What am I missing?

 

Here's   the pertinent part of the script ( which runs in a "Run Script" block as the first step in a workflow 😞

 

--- start script --

var list1 = current.variables.system

current.description = "location 1";   // for debugging purposes

var systemlist = list1.split(',');

current.description = "location 2";     // for debugging purposes

-- end script --

 

current.variables.system is a list collector type of variable.

When I submit the form,   the description of the requested item shows "location 1".   So I know we make it to the split, but not past it.

 

Any ideas?

1 ACCEPTED SOLUTION

randrews
Tera Guru

I believe you need to feed your list into a string with this command



list1 = current.variables.system.toString();



instead of how you have it.. you are trying to split an array that is already split.


View solution in original post

3 REPLIES 3

randrews
Tera Guru

I believe you need to feed your list into a string with this command



list1 = current.variables.system.toString();



instead of how you have it.. you are trying to split an array that is already split.


This tip worked great!   Thanks randnews!



This leads up to another issue, in that I get a bunch of sysids and not human readable names.



But that's another topic and I'm opening another disocussion on that point.



THANK YOU!


i believe adding .getDisplayValue() to the variable should give you the common name..



if not go into the dictionary for   the field you want to be the display value and set that as display true <be aware each table can have one and only one display value>