- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 10:38 PM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 11:23 PM - edited 03-28-2023 11:36 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 10:45 PM
Hi @Supriya39 ,
Please add screenshot of your custom action.
Thanks,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 10:54 PM
Find below screenshot of action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 11:07 PM
Hi @Supriya39 ,
Created same action and it was returning array, Please find attachments for more details.
Thanks,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 11:23 PM - edited 03-28-2023 11:36 PM
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!