Inbound Action not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2023 06:32 AM
Hello, I have a problem with my inbound action script...
The point is that all messages that come from the integration.support.prod@.com" or "integration.support.test@.com" mailboxes should be redirected to the appropriate Services and they should create indices that will have the correct Service in the fields .
The problem is that now I don't have any incidents at all... I messed something up.
The premise is:
1. If the word SMPI is included in the email, the message generates an incident where SMPI is selected in the Service
2. If the word ODS is present - the message generates an incident where the Service selected is ODS
3. Same for Kepler.
Assigment group as in the script... what went wrong?
(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
//check email from
var callSI = new hmInboundEmail();
var emailFrom = callSI.checkEmailFrom(email.from);
var emailFromThirdParty = callSI.checkThirdPartyEmail(email.from);
//if email from is SEGRO/Whitelisted
if (emailFrom == 'SEGRO' || emailFrom == 'Whitelisted') {
var emailBody = email.body_text;
var maxChars = 524288;
if (emailBody.length > maxChars) {
emailBody = emailBody.substring(0, maxChars);
}
current.short_description = email.subject;
current.description = "received from: " + email.origemail + "\n\n" + emailBody;
current.contact_type = "email";
current.state = 1; //New state
if (emailFrom == 'SEGRO') {
current.caller_id = gs.getUserID();
if (email.from == "integration.support.prod@segro.com" || email.from == "integration.support.test@segro.com") {
if (emailBody.includes("SMPI")) {
current.business_service = gs.getProperty('seg.business_service.SMPI');
current.assignment_group = gs.getProperty('seg.group.l3_applications'); // L3 - Applications
}
} else if (emailBody.includes("ODS")) {
current.business_service = gs.getProperty('seg.business_service.ODS');
current.assignment_group = gs.getProperty('seg.group.l3_infrastructure'); // L3 - Infrastructure
} else if (emailBody.includes("Kepler")) {
current.business_service = gs.getProperty('seg.business_service.Kepler');
current.assignment_group = gs.getProperty('seg.group.l3_applications'); // L3 - Applications
} else {
current.business_service = gs.getProperty('seg.business_service.default');
current.assignment_group = gs.getProperty('hm.l1.techbar.group.sys.id'); // Domyślna grupa
}
var dateTime = new GlideDateTime();
dateTime.addSeconds(60);
gs.eventQueueScheduled('agile.solution.incident.email', current, '', '', dateTime);
} else {
current.assignment_group = gs.getProperty('hm.l1.techbar.group.sys.id'); // L1 - TechBar group
}
if (email.from == "solarwinds-noreply@segro.com") {
current.impact = 1;
current.urgency = 2;
}
}
if (email.from == "defender-noreply@microsoft.com") {
current.assignment_group = gs.getProperty('hm.l1.techbar.group.sys.id'); // L1 - TechBar group
current.impact = 1;
current.urgency = 2;
}
if (email.from == "DefenderCloudnoreply@microsoft.com") {
current.assignment_group = gs.getProperty('hm.l1.techbar.group.sys.id'); // L1 - TechBar group
current.impact = 1;
current.urgency = 2;
if (emailFromThirdParty) {
current.category = "fix required";
current.caller_id = emailFromThirdParty.getUniqueValue();
current.business_service = gs.getProperty("seg.business_service.data_warehouse");
current.assignment_group = gs.getProperty("seg.group.l3_applications");
current.u_guest_contact_email = email.from;
if (emailFromThirdParty.u_associated_service.toString() != "") { // when no service associated, then take default, not null
current.business_service = emailFromThirdParty.u_associated_service.toString();
}
}
if (emailFrom == 'Whitelisted') {
var whitelistedRec = callSI.whitelistedRec(email.from);
current.u_guest_contact_email = email.from;
current.company = whitelistedRec.u_company;
current.caller_id = whitelistedRec.dl_notify;
}
current.insert();
} else { //if NON - SEGRO
gs.eventQueue('hm.bouncback.email', '', email.from, email.from);
}
})(current, event, email, logger, classifier);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2023 07:51 AM
@New user1212 Try adding gs.info(''); statements in your code at different places and check if the Inbound action is executing and upto which line it is executing. It may be possible that your script is crashing at some line and hence the record is not getting created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2023 08:08 AM
Try this script.
(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
//check email from
var callSI = new hmInboundEmail();
var emailFrom = callSI.checkEmailFrom(email.from);
var emailFromThirdParty = callSI.checkThirdPartyEmail(email.from);
//if email from is SEGRO/Whitelisted
if (emailFrom == 'SEGRO' || emailFrom == 'Whitelisted') {
var emailBody = email.body_text;
var maxChars = 524288;
if (emailBody.length > maxChars) {
emailBody = emailBody.substring(0, maxChars);
}
current.short_description = email.subject;
current.description = "received from: " + email.origemail + "\n\n" + emailBody;
current.contact_type = "email";
current.state = 1; //New state
if (emailFrom == 'SEGRO') {
current.caller_id = gs.getUserID();
if (email.from == "integration.support.prod@segro.com" || email.from == "integration.support.test@segro.com") {
if (emailBody.includes("SMPI")) {
current.business_service = gs.getProperty('seg.business_service.SMPI');
current.assignment_group = gs.getProperty('seg.group.l3_applications'); // L3 - Applications
} else if (emailBody.includes("ODS")) {
current.business_service = gs.getProperty('seg.business_service.ODS');
current.assignment_group = gs.getProperty('seg.group.l3_infrastructure'); // L3 - Infrastructure
} else if (emailBody.includes("Kepler")) {
current.business_service = gs.getProperty('seg.business_service.Kepler');
current.assignment_group = gs.getProperty('seg.group.l3_applications'); // L3 - Applications
} else {
current.business_service = gs.getProperty('seg.business_service.default');
current.assignment_group = gs.getProperty('hm.l1.techbar.group.sys.id'); // Domyślna grupa
}
}
var dateTime = new GlideDateTime();
dateTime.addSeconds(60);
gs.eventQueueScheduled('agile.solution.incident.email', current, '', '', dateTime);
} else {
current.assignment_group = gs.getProperty('hm.l1.techbar.group.sys.id'); // L1 - TechBar group
}
if (email.from == "solarwinds-noreply@segro.com") {
current.impact = 1;
current.urgency = 2;
}
}
if (email.from == "defender-noreply@microsoft.com") {
current.assignment_group = gs.getProperty('hm.l1.techbar.group.sys.id'); // L1 - TechBar group
current.impact = 1;
current.urgency = 2;
}
if (email.from == "DefenderCloudnoreply@microsoft.com") {
current.assignment_group = gs.getProperty('hm.l1.techbar.group.sys.id'); // L1 - TechBar group
current.impact = 1;
current.urgency = 2;
if (emailFromThirdParty) {
current.category = "fix required";
current.caller_id = emailFromThirdParty.getUniqueValue();
current.business_service = gs.getProperty("seg.business_service.data_warehouse");
current.assignment_group = gs.getProperty("seg.group.l3_applications");
current.u_guest_contact_email = email.from;
if (emailFromThirdParty.u_associated_service.toString() != "") { // when no service associated, then take default, not null
current.business_service = emailFromThirdParty.u_associated_service.toString();
}
}
if (emailFrom == 'Whitelisted') {
var whitelistedRec = callSI.whitelistedRec(email.from);
current.u_guest_contact_email = email.from;
current.company = whitelistedRec.u_company;
current.caller_id = whitelistedRec.dl_notify;
}
current.insert();
} else { //if NON - SEGRO
gs.eventQueue('hm.bouncback.email', '', email.from, email.from);
}
})(current, event, email, logger, classifier);
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2023 09:45 AM
looks the same as mine, unfortunately it does not work, the incident does not occur