inbound
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2024 04:07 AM - edited ‎01-16-2024 02:32 AM
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2024 04:43 AM
Hello @Jyo090
Please try below code.
(function runAction( /* GlideRecord */ current, /* GlideRecord */ event, /* EmailWrapper */ email, /* ScopedEmailLogger */ logger, /* EmailClassifier */ classifier) {
var emailBody = email.body_text;
var disclaimer = "This email is sent on behalf of xxxxx Group plc";
var rows = emailBody.split('\n'); // Split the email body into lines
var headerRow = rows[0].split('\t'); // Assuming tab-separated columns in the header row
for (var i = 1; i < rows.length; i++) {
if (rows[i].indexOf(disclaimer) != -1) {
continue;
}
var rowValues = rows[i].split('\t'); // Assuming tab-separated columns in each row
if (rowValues.length !== headerRow.length) {
// Skip rows that do not have the same number of columns as the header
continue;
}
var scTask = new GlideRecord('sc_task');
scTask.initialize();
var description = '';
for (var j = 0; j < headerRow.length; j++) {
description += headerRow[j] + ':' + rowValues[j] + '\n';
// Assuming you want to set a specific field based on a condition, e.g., j == 1
if (j == 1) {
scTask.u_arcu_application_id = rowValues[j];
}
}
scTask.short_description = 'Task for Ercu';
scTask.description = description.trim();
scTask.assignment_group = "628fc212979f5d5005fcb00de053afb1";
try {
scTask.insert();
} catch (e) {
gs.error('Error creating sc_task record: ' + e);
}
}
})(current, event, email, logger, classifier);
Thanks
Kartik Magadum
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2024 05:20 AM
Without submitting a sample e-mail it is not possible to say whether what you have above is good or not.