List collector, Flow, email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 10:54 AM
Hello all,
How can I add list collector variables that reference cmdb in the body of an email. My flow is a trigger. For example, the user go to the portal to request a pentest. The user fills out a form. One of the questions is Application - Please select your application/applications from the drop down box. The user may select multiple applications. When the form is complete they click the submit button. A record is created in snow_application and send in email thanking them for their submission and in the body we need to add the multiple applications that will be pentested. Any help will be appreciated. I have tried a record lookup, loop and action in the flow so far without success. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 12:59 PM
Retrieve the List Collector Variable in Flow Designer
In Flow Designer, add a Record Lookup step.
- Table: sc_req_item (or the table storing the variable).
- Condition: Match the RITM from the trigger.
Add a Get Catalog Variables step.
- Select the variable containing the List Collector values.
Process the List Collector Data
- Use a Script Action to process the selected items.
- Add a Script Action (or Transform Function) in Flow Designer with script:
Sample Script:
(function execute(inputs, outputs) {
var apps = [];
var listCollectorValues = inputs.application_list; // Replace with your actual List Collector variable name
if (listCollectorValues) {
var gr = new GlideRecord('cmdb_ci'); // Change if referencing another table
gr.addQuery('sys_id', 'IN', listCollectorValues);
gr.query();
while (gr.next()) {
apps.push(gr.getValue('name')); // Replace 'name' with the field to display
}
}
outputs.formattedApps = apps.join(', '); // Format the list into a string
})(inputs, outputs);
- Inputs: application_list (List Collector variable)
- Outputs: formattedApps (Comma-separated list of application names)
Add to Email Notification in Flow Designer
- In the Send Email action:
- Subject: Thank you for your Pentest Request
- Sample Body:
<p>Dear ${requested_for},</p>
<p>Thank you for submitting a request for a pentest.</p>
<p>The following applications will be tested:</p>
<ul>
${formattedApps}
</ul>
<p>We will review your request and follow up accordingly.</p>
- Use ${formattedApps} as the formatted List Collector value.
ɪꜰ ᴍʏ ᴀɴꜱᴡᴇʀ ʜᴀꜱ ʜᴇʟᴘᴇᴅ ᴡɪᴛʜ ʏᴏᴜʀ Qᴜᴇꜱᴛɪᴏɴ, ᴘʟᴇᴀꜱᴇ ᴍᴀʀᴋ ᴍʏ ᴀɴꜱᴡᴇʀ ᴀꜱ ᴛʜᴇ ᴀᴄᴄᴇᴘᴛᴇᴅ ꜱᴏʟᴜᴛɪᴏɴ ᴀɴᴅ ɢɪᴠᴇ ᴀ ᴛʜᴜᴍʙꜱ ᴜᴘ.
ʙᴇꜱᴛ ʀᴇɢᴀʀᴅꜱ
ꜱʀᴇᴇʀᴀᴍ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 07:19 PM
Hi @Marc_007
Please have a look on the below posts:
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.