The Zurich release has arrived! Interested in new features and functionalities? Click here for more

if sender is abel tuter@service now.com, create the incident ticket with contents of the email. create incident ticket to technical group with short description software issue and create another incident ticket for cmdb group with short description w

Mandhula Harish
Kilo Contributor

For example:-

if sender is abel tuter@service now.com, create two incident tickets with contents of the email and assign to two different assignment groups.

create incident ticket to

1. Technical group with short description as "software issue"     and

2. create another incident ticket for cmdb group with short description as "windows server".

1 ACCEPTED SOLUTION

Imran Ahmad1
Kilo Guru

 

find_real_file.png

find_real_file.png

 

find_real_file.png

 

 

Hii @Mandhula Harish,
 

You can also try this code to achieve your requirement, It's easy to understand the logic and Tested by me:-

create Inbound Email Action

In Action tab copy and paste below code and change sys id as per your business requirement.

 

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
    
    
var group = ["019ad92ec7230010393d265c95c260dd","0a52d3dcd7011200f2d224837e6103f2"]; // Instead of passing sys_id in code try to create system properties and call it in array name is group its good pratice and recommended by servicenow.
    
    var short_description = ["software issue","windows server"];
    var j = 0;
    for(var i = 0 ; i<= group.length-1;i++){        
        
    var gr = new GlideRecord("incident");
    gr.intialize();
    gr.assignment_group = group[i];
    gr.short_description = short_description[j];
        gr.description = email.body_text;
            gr.insert();
        j=j+1;
    
        }
    

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

 

 

 

Regards,

Imran Ahmad

 

 

Please send your feedback

Please Mark helpful below:-

View solution in original post

11 REPLIES 11

Imran Ahmad1
Kilo Guru

Hii Mandhula,

Try this code its very simple and 100% working and tested by me:-

Create Inbound Email Action.

In Action tab paste this code and change the sys_id to your required group.

 

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
    
    
var group = ["019ad92ec7230010393d265c95c260dd","0a52d3dcd7011200f2d224837e6103f2"]; // Instead of passing sys_id in code try to create system properties and call it in array name is group its good pratice and recommended by servicenow.
    
    var short_description = ["software issue","windows server"];
    var j = 0;
    for(var i = 0 ; i<= group.length-1;i++){        
        
    var gr = new GlideRecord("incident");
    gr.intialize();
    gr.assignment_group = group[i];
    gr.short_description = short_description[j];
        gr.description = email.body_text;
            gr.insert();
        j=j+1;
    
        }
    

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

 

If you are testing from PDI then copy your instance number like: dev98098@servicenowdevelopers.com

But the email Id your are using for testing that email ID should be email of Abel Tuter edit it from sys_user tale.

 

 

Regards,

Imran Ahmad

 

Please Mark Helpful below:

Imran Ahmad1
Kilo Guru

 

find_real_file.png

find_real_file.png

 

find_real_file.png

 

 

Hii @Mandhula Harish,
 

You can also try this code to achieve your requirement, It's easy to understand the logic and Tested by me:-

create Inbound Email Action

In Action tab copy and paste below code and change sys id as per your business requirement.

 

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
    
    
var group = ["019ad92ec7230010393d265c95c260dd","0a52d3dcd7011200f2d224837e6103f2"]; // Instead of passing sys_id in code try to create system properties and call it in array name is group its good pratice and recommended by servicenow.
    
    var short_description = ["software issue","windows server"];
    var j = 0;
    for(var i = 0 ; i<= group.length-1;i++){        
        
    var gr = new GlideRecord("incident");
    gr.intialize();
    gr.assignment_group = group[i];
    gr.short_description = short_description[j];
        gr.description = email.body_text;
            gr.insert();
        j=j+1;
    
        }
    

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

 

 

 

Regards,

Imran Ahmad

 

 

Please send your feedback

Please Mark helpful below:-