- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2023 02:17 AM
I had created incidents using inbound email actions but customer wants them to be created according to priority. for example if email subject line contains Non critical then the incident should be created with medium priority. if the email subject contains critical then the incident should get created with high priority. can i know how to achieve this. I tried using the below script in inbound email action but its not working.
current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;
if(email.subject.indexOf("critical")>-1)
{
current.impact= "1";
current.urgency= "1";
current.priority= "1";
}
else if(email.subject.indexOf("Non critical")>-1)
{
current.impact= "2";
current.urgency= "2";
current.priority= "3";
}
current.incident_state = IncidentState.NEW;
current.category= "Scheduled Job Failure";
current.description= email.body_text;
current.insert();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2023 10:51 AM
var sub = email.subject;
current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = sub;
if(sub.indexOf("critical")>-1)
{
current.impact= "1";
current.urgency= "1";
current.priority= "1";
}
else if(sub.indexOf("Non critical")>-1)
{
current.impact= "2";
current.urgency= "2";
current.priority= "3";
}
current.incident_state = IncidentState.NEW;
current.category= "Scheduled Job Failure";
current.description= email.body_text;
current.insert();
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2023 08:46 AM
You can try like ask them to send critical or non critical in starting of subject
then in script
var sub = email.subject;
current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = sub;
if(sub.indexOf("Critical")==0)
{
current.impact= "1";
current.urgency= "1";
current.priority= "1";
}
else if(sub.indexOf("Non")==0)
{
current.impact= "2";
current.urgency= "2";
current.priority= "3";
}
current.incident_state = IncidentState.NEW;
current.category= "Scheduled Job Failure";
current.description= email.body_text;
current.insert();
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2023 10:51 AM
var sub = email.subject;
current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = sub;
if(sub.indexOf("critical")>-1)
{
current.impact= "1";
current.urgency= "1";
current.priority= "1";
}
else if(sub.indexOf("Non critical")>-1)
{
current.impact= "2";
current.urgency= "2";
current.priority= "3";
}
current.incident_state = IncidentState.NEW;
current.category= "Scheduled Job Failure";
current.description= email.body_text;
current.insert();
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 07:00 AM
The code is working fine but there is same keyword "Critical" in both the conditions so the incidents are getting with same priority. can you help me to generate them with different priorities with out changing the keyword.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2023 08:46 AM
You can try like ask them to send critical or non critical in starting of subject
then in script
var sub = email.subject;
current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = sub;
if(sub.indexOf("Critical")==0)
{
current.impact= "1";
current.urgency= "1";
current.priority= "1";
}
else if(sub.indexOf("Non")==0)
{
current.impact= "2";
current.urgency= "2";
current.priority= "3";
}
current.incident_state = IncidentState.NEW;
current.category= "Scheduled Job Failure";
current.description= email.body_text;
current.insert();
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2023 03:40 AM