reply emails shall be copied to associated child cases and incidents.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2024 03:33 AM
I have a requirement that when the client replies to some cases from the email method the reply email must be copied to associated incident.
The same content email received must be copied to the incident also. Can anyone help ?
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2024 10:57 PM
Hi @kalakaramad_20
Yes, that's for inbound action only-
(function runMailScript(email, template, table, record) {
var inc = parseIncidentNumber(email.body);
var emailBody = email.body_text; // Assuming plain text email
var incGR = new GlideRecord('incident');
if (incGR.get('number', inc)) {
incGR.comments = "Client reply:\n" + emailBody;
incGR.update();
sendEmailToIncident(incGR.sys_id, emailBody);
} else {
// Your existing inbound action logic here
var case_state = current.state;
if (current.state == 500) {
var lines = email.body_text.split('\n');
var firstword = "";
if (lines.length > 0)
firstword = lines[0].replace(/^\s+|\s+$/g,'');
firstline = firstword.toLowerCase();
if (firstline) {
if(firstline.indexOf("reject") == 0)
current.state = 2; // Set the state to 10 (assuming this means "rejected")
else if(firstline.indexOf("accept") == 0)
current.state = 6;
}
}
if (current.getTableName() == 'sn_customerservice_case') {
current.comments = current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
}
else if (current.u_on_hold_reason_1 == 1) {
current.state = 2;
}
else if (current.state == 200) {
current.state = 2;
}
else {
current.sys_updated_on = "";
}
current.update();
}
})(email, template, table, record);
function parseIncidentNumber(emailBody) {
// Logic to parse incident number from email body
// Return incident number
}
function sendEmailToIncident(incidentSysId, emailBody) {
// Logic to send email copy to associated incident
}
Please mark my answer helpful and correct.
Regards,
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2024 12:15 AM
hey tried this but the reply comments are not copied to the incident using this in the inbound action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2024 11:52 PM
Can you share the sample email subject line and body so that I can relevant adjustments in the script.
Regards,
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 12:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 12:24 AM
Could you please check.