- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2025 02:08 AM - edited 06-11-2025 02:09 AM
Hi Community,
We have a flow setup that will email a person's line manager a few days before their leave date and I want to add the leavers assets into the email, can anyone adivse on the best way to achive this as at present we can only get one asset returned.
Here is the flow:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2025 03:03 AM
you can use a flow variable and concatenate the assets of that user by iterating using For Each
Then in single email use that flow variable to print all the assets
check how you can append/concatenate the assets in flow variable using For Each
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2025 02:41 AM
@Sandeep Rajput @SANDEEP DUTTA @Mark Manders @Ankur Bawiskar @Shivalika any help here.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2025 02:52 AM
There are 2 ways to handle this. Either do a lookup to the asset table and get the assets of the user and add them to a string variable (update the variable for each found asset) and use the text from the variable in the 'send email' body. Or use the 'send notification' action and do a lookup to all assets within an email notification script and add that script to the body of your notification.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2025 03:03 AM
you can use a flow variable and concatenate the assets of that user by iterating using For Each
Then in single email use that flow variable to print all the assets
check how you can append/concatenate the assets in flow variable using For Each
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2025 03:27 AM
Hi @Alex Saager1
I believe you've set up your flow on the sys_user table. If yes, then you can try the below approach.
1. Create one email script to fetch all the assets which belongs to the current user.
var emp = current.sys_id;
var content;
template.print('<table border="1"> <tr> <th>Asset ID</th> <th>Name</th><th>Custodian</th></tr>');
var assets = new GlideRecord('alm_asset');
assets.addEncodedQuery("assigned_to!=NULL^asset_tagISNOTEMPTY^assigned_to="+emp); // MODIFY THIS QUERY AS REQUIRED
assets.query();
while (assets.next()) {
var str = '<tr> <td>' + assets.asset_tag + '</td> <td>' + assets.display_name + '</td> <td>' + assets.getDisplayValue('assigned_to') + '</td> </tr>';
template.print(str);
}
template.print(' </table>');
2. Create a notification with the "Send When" value is 'triggered'
3. Call your notification in the flow using "Send Notification" action
Result:
Hope this helps.
Regards,
Siva