Assigning the tickets to groups from alerts

Renu4
Tera Contributor

Hello All,

 

I have a question regarding assigning the tickets based on the code in Subject line of the assignment group.

Situation: We have alerts coming from our firewall support team.

These are alert emails.In the subject line of the email we have the location names mentioned.

I want to extract these location codes and asign the tickets to the local Servicedesk.

Eg: if ticket is from india then assign it to it_servicedesk india

if it is china the IT_Servicedesk_China etc.

Now i have written an inbound email which creates a ticket but does not assign the ticket to the groups.

Help would be appreciated.

 

Thanks in advance,

Renu.

6 REPLIES 6

Anirudh Pathak
Mega Sage

Hi @Renu4 ,

Can you share your code which you have tried?

Also an example of how the subject line looks?

Hi Ani07,

the subject line image is attached below.

Inbound actions are here:

(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

    current.caller_id = gs.getUserID();
    current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
    current.short_description = email.subject;
    current.state = IncidentState.NEW;
    current.urgency = 1;
    current.impact = 1;
    current.contact_type = "monitoring";

    if (email.body.assign != undefined)
        current.assigned_to = email.body.assign;
    if (email.importance != undefined) {
        if (email.importance.toLowerCase() == "high")
            current.priority = 1;
    }
    if (email.body.priority != undefined)
        current.priority = email.body.priority;
    current.insert();
    // 
})(current, event, email, logger, classifier);

Hi @Renu4 ,

 

No were here you have used my logic ?

try this but you need to adjust the code to make it work on your instance,

 

(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

    current.caller_id = gs.getUserID();
    current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
    current.short_description = email.subject;
    current.state = IncidentState.NEW;
    current.urgency = 1;
    current.impact = 1;
    current.contact_type = "monitoring";

    if (email.body.assign != undefined)
        current.assigned_to = email.body.assign;
    if (email.importance != undefined) {
        if (email.importance.toLowerCase() == "high")
            current.priority = 1;
    }
    if (email.body.priority != undefined)
        current.priority = email.body.priority;

////////////// here is my logic ///////////////////////
if((email.subject.indexOf('china') <= -1){

current.assignment_group = 'sys_id' // use sys_id of the group or call sys_properties 
} else if ((email.subject.indexOf('india') <= -1){

current.assignment_group = 'sys_id' // use sys_id of the group or call sys_properties 
} ((email.subject.indexOf('brazil') <= -1){

current.assignment_group = 'sys_id' // use sys_id of the group or call sys_properties 
}
////////////// here is my logic ///////////////////////



    current.insert();
    
})(current, event, email, logger, classifier);


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Hi Sohail,

i used the same logic but now the issue is if i give any location the mail is being triggered only to india sevicedesk.

i mean to say its not checking for the else if part of the code.

 

(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

        current.caller_id = gs.getUserID();
        current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
        current.short_description = email.subject;
        current.state = IncidentState.NEW;
        current.urgency = 1;
        current.impact = 1;
        current.contact_type = "email";

        if (email.body.assign != undefined)
            current.assigned_to = email.body.assign;
        if (email.importance != undefined) {
            if (email.importance.toLowerCase() == "high")
                current.priority = 1;
        }
        if (email.body.priority != undefined)
            current.priority = email.body.priority;
   
   
    if (email.subject.indexOf('nanjangud') <= -1) {

        current.assignment_group = '0fadf5281b0dc090a6fc62c7bd4bcb27' ;// use sys_id of the group or call sys_properties
    }
    else if (email.subject.indexOf('Shanghai') <= -1) {

            current.assignment_group = "b43eb9281b0dc090a6fc62c7bd4bcbe7" ;// use sys_id of the group or call sys_properties
        }
                current.insert();

        // })(current, event, email, logger, classifier);
the conditions are:
Renu4_0-1710391283085.png