Flow Action to separate comma separate string to array

Supriya39
Giga Guru

Hi All,

 

I have a column EmailTo which contains comma separated emailids. I want to separate them in to an array of email ids and loop them through for loop.  I tried creating an flow variable and used split string function but it is not taken by for each loop since its of type String. Also tried creating action but errors out.

 

1 ACCEPTED SOLUTION

Hi @Supriya39 ,
Can you please make use of the below script and try it out?

 

var email_string = inputs.EmailToString.toString();
var temp_array;
if(email_string.length>0)
{
temp_array = email_string.split(',');
gs.info("Array Length "+temp_array.length);
outputs.emailtoarray = temp_array;
}
else
gs.info("Email String doesn't have any value");


Points:

1) There is no need to use new Array(). For simplicity, readability and execution speed, use the array literal method.

2) Corrected Output variable name and shared revised script for your reference.

Regards,
Bharat Daswani

If provided answer helps you to address your issue, Would request you to accept the solution and hit "Helpful". Thank you!

View solution in original post

5 REPLIES 5

Gopi Naik1
Kilo Sage

Hi @Supriya39 ,

 

Please add screenshot of your custom action.

 

 

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi

Supriya39
Giga Guru

Find below screenshot of action

Supriya39_0-1680069240929.png

 

Hi @Supriya39 ,

 

Created same action and it was returning array, Please find attachments for more details.

 

 

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi

Hi @Supriya39 ,
Can you please make use of the below script and try it out?

 

var email_string = inputs.EmailToString.toString();
var temp_array;
if(email_string.length>0)
{
temp_array = email_string.split(',');
gs.info("Array Length "+temp_array.length);
outputs.emailtoarray = temp_array;
}
else
gs.info("Email String doesn't have any value");


Points:

1) There is no need to use new Array(). For simplicity, readability and execution speed, use the array literal method.

2) Corrected Output variable name and shared revised script for your reference.

Regards,
Bharat Daswani

If provided answer helps you to address your issue, Would request you to accept the solution and hit "Helpful". Thank you!