Flow Designer - Group Items

HeatherC1
Tera Contributor

I would like to use flow designer to look up a few items and then email out on those items. I don't want to have an individual email for each item, I would like it to be in one email. I can not figure out how to do this. Can anyone provide any guidance? 

 

Thank you! 

1 ACCEPTED SOLUTION

dave_slusher
ServiceNow Employee
ServiceNow Employee

Here's an example. Let's say that step one is a Lookup Records step that on the cmdb_ci_business_applications table. For Step 2, you add your Send Email step to whatever recipients and with whatever title you desire.  For the body, you'll use an inline function (the f(x) just to the right of the box).

---

var cis = [];
var gr = fd_data._1__look_up_records.records;

while (gr.next()) {
cis.push(gr.getDisplayValue());

}


return "These CIs need remediation: \n<br />" + cis.join("<br />\n");

---

If it is a different number, when you are in the editor for the inline script you can always start with "fd_data." and it will autocomplete with anything it can resolve. It's like the script equivalent of a data pill.

 

Let me know if you need any more detail. Thanks to @pouyan for looping me in on this!

View solution in original post

7 REPLIES 7

sachin_namjoshi
Kilo Patron
Kilo Patron

You will need to use for each loop in your flow and then use send email action in flow designer.

 

For Each Flow Logic

 

Send Email

 

Regards,

Sachin

 

HeatherC1
Tera Contributor

I am looking for a way to group all the results into one email not many. 

dave_slusher
ServiceNow Employee
ServiceNow Employee

Here's an example. Let's say that step one is a Lookup Records step that on the cmdb_ci_business_applications table. For Step 2, you add your Send Email step to whatever recipients and with whatever title you desire.  For the body, you'll use an inline function (the f(x) just to the right of the box).

---

var cis = [];
var gr = fd_data._1__look_up_records.records;

while (gr.next()) {
cis.push(gr.getDisplayValue());

}


return "These CIs need remediation: \n<br />" + cis.join("<br />\n");

---

If it is a different number, when you are in the editor for the inline script you can always start with "fd_data." and it will autocomplete with anything it can resolve. It's like the script equivalent of a data pill.

 

Let me know if you need any more detail. Thanks to @pouyan for looping me in on this!

Thank you Dave! This is a great piece of code to build onto. To keep building, would I/Could I  set additional variables to display more information on these records? Outside of just their display name?