How to convert template data into inbound action for creation incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
I will get above template from user in email
what script we will use for converting this data into incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Refer below videos that explains how to parse email body to incident fields using Flow Designer,
https://www.youtube.com/watch?v=uLHCw2GA3lo
https://www.youtube.com/watch?v=wYnwEfcUNnU
If you are using inbound action, try below
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
like i will use normal script for getting project value -
if (email.body.projectt != undefined) {
current.u_project = email.body.project;
}
so i will receive data through email in html format (in table format, like rows and columns)
so how i can convert tabular data or table format data into incident via inbound action.
what changes in script needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
@Kat123 Please try the below script. For this sample, I mapped Title to Short Description and Project to Description. You can replace them with the relevant fields as needed.
var htmlBody = email.body_html;
var parser = new GlideXMLUtil();
var doc = parser.parse(htmlBody);
var title = "";
var project = "";
var rows = doc.getElementsByTagName("tr");
for (var i = 0; i < rows.getLength(); i++) {
var cells = rows.item(i).getElementsByTagName("td");
if (cells.getLength() >= 2) {
var label = cells.item(0).getTextContent().trim().toLowerCase();
var value = cells.item(1).getTextContent().trim();
if (label.indexOf("title") > -1) {
title = value;
}
if (label.indexOf("project") > -1) {
project = value;
}
}
}
var inc = new GlideRecord("incident");
inc.initialize();
inc.short_description = title || "No Title Provided";
inc.description = project || "No Project Provided";
inc.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
not creating incident
getting 'Incident Creation : did not create or update incident using current ' in email log