- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 01:04 PM
Hi Guys,
I need to send an email from a Flow Designer. The email must contain the values of a list collector. I need help adding these values to the body of the email.
Example email:
Hi Joe,
Request #123456 has been completed. You are now the owner of the following accounts:
- List collector value 1
- List collector value 2
- List collector value 3
Please assist.
Thank you!
Regards,
Jocelyn
Solved! Go to Solution.
- Labels:
-
flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2020 07:34 AM
you cannot use For each loop directly on list collector variable.
you will have to convert String and return String Array which can then be used in For Each
Refer below links for help and the steps
How to iterate an Array.String in the flow designer?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 07:24 AM
Your case bit mix of data pill and scripting so i can suggest one work around.
First type whatever thing you want in email body. Mainly static text and with desired html design (bullet, bold etc).
Then copy the source code ('<>' icon on editor)
Now you need to replace 'number' with request number data pill and add account as '<li>' with actual value. So clear this body and start writing inline script.
/*
**Access Flow/Action data using the fd_data object. Script must return a value.
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/
var htmlPrefix = '<p>Hello Joe</p>\n'+
'<p>Request <strong>'+fd_data.trigger.current.number+'</strong> is completed. You are owner of,</p>\n'+
'<ol>';
var htmlpostfix = '</ol>'
----
your script
while(sftp.next()){
htmlPrefix+='<li>'+sftp.getValue('u_account_id')+'</li>';
}
var html = htmlPrefix + htmlpostfix;
return html;
Please mark correct & helpful if that works.
Regards
Deepen shah
aavenir.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2020 07:34 AM
you cannot use For each loop directly on list collector variable.
you will have to convert String and return String Array which can then be used in For Each
Refer below links for help and the steps
How to iterate an Array.String in the flow designer?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2020 08:44 AM
Hi Ankur,
Thanks again 🙂
Is there a way to use the data pill to add the values of the list collector to the body of the email?
Regards,
Jocelyn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2020 08:51 AM
please check this in body script section
var variableDisplayValueArray = fd_data.trigger.request_item.variables.list_collector_variable.getDisplayValue();
// now iterate over this array in email body script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2020 09:45 AM
Let me know if that answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader