Create an incident when inbound email actions fails

suuriya
Tera Contributor

Hi Community,

 

I have a requirement; the operation team send the mail to ServiceNow production GMB the mail body consist of Applications and APM ID based on the APM ID in mail the system look for what application that apm id belongs and the assignment group and it creates an incident to that group....And it was Woking as expected and done via Inbound email actions.

 

But this is currently not working consistently, system is not auto creating the incident for this process consistently ...In this scenario the incident needs to be created to IToc team with

caller: Itoc operation (user record exists)

Opened on behalf of :itoc operation

desc: body of mail

configuration item: server name included in mail body

assignment group : itoc operation

 

Existing inbound action: 

suuriya_0-1702981863949.png

Inbound script:

var serName = email.body.name.toString();
var APMID = email.body.apmid.toString();
var App = APMID.replace(/,/g,'');
var Group = GetAssignmentGroup();

if (JSUtil.nil(APMID)){
    current.assignment_group.setDisplayValue("ITOC-Cloud-Operations");
}
if (JSUtil.nil(Group)){
    current.assignment_group.setDisplayValue("ITOC-Cloud-Operations");
}
else {
    current.assignment_group = Group;
}

current.cmdb_ci = GetBussApp();

function GetAssignmentGroup(){
    var busApp = new GlideRecord("cmdb_ci_business_app");
    busApp.addQuery("u_legacy_application_id" , App);
    busApp.query();
    if (busApp.next()){
        return busApp.u_primary_assignment_group;
    }
}

function GetBussApp(){
    var busApp = new GlideRecord("cmdb_ci_business_app");
    busApp.addQuery("u_legacy_application_id" , App);
    busApp.query();
    if (busApp.next()){
        return busApp.sys_id;
    }
}

current.insert();

 

Please do let me know how we can achieve this.

 

Thanks in advance 

0 REPLIES 0