- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 04:27 AM
Hello everyone,
little bit of background, I have create a flow for catalog item, user will attach an excel file and via flow, data is automatically imported to the target table.
As a next step, I would like to add email action to the flow if errors occure during the data import, the email should contain all of the error messages. Can you advise what is the best approach to do this?
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 05:53 AM
better to use direct notification on table sys_import_set_run (Transform History).
You can call this notification from your flow using Send Notification action
something like this to show the status of inserts, updates, ignored, skipped etc
Email script:
(function runMailScript(current, template, email, email_action, event) {
template.print("Total:"+current.total+"<br/>");
template.print("Inserts:"+current.inserts+"<br/>");
template.print("Updates:"+current.updates+"<br/>");
template.print("Ignored:"+current.ignored+"<br/>");
template.print("Skipped:"+current.skipped+"<br/>");
template.print("Errors:"+current.errors+"<br/>");
//}
})(current, template, email, email_action, event);
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 05:13 AM - edited 10-06-2022 05:13 AM
- Get a copy of the file. The excel file provided for this flow will always need to be in the same format
- Create a data source, transform map and import set based on this template
- Test with some data to make sure it works
- Create scheduled import for that data source
- Add attachment variable to your catalog item
- Create flow
- Adapt solution on this blog post to execute scheduled import using attachment from variable instead of attachment from email
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 05:44 AM
Thank you for response. I want to extract error messages from import data, if any occured and send those via email via flow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 05:53 AM
better to use direct notification on table sys_import_set_run (Transform History).
You can call this notification from your flow using Send Notification action
something like this to show the status of inserts, updates, ignored, skipped etc
Email script:
(function runMailScript(current, template, email, email_action, event) {
template.print("Total:"+current.total+"<br/>");
template.print("Inserts:"+current.inserts+"<br/>");
template.print("Updates:"+current.updates+"<br/>");
template.print("Ignored:"+current.ignored+"<br/>");
template.print("Skipped:"+current.skipped+"<br/>");
template.print("Errors:"+current.errors+"<br/>");
//}
})(current, template, email, email_action, event);
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 06:27 AM - edited 10-06-2022 06:32 AM
@Ankur Bawiskar One more question, how to call the notification from the flow via Send notification action and and the same time keep the conditions for the notification? I can only see these two notification.