How to set incident priority from email subject (Inbound Action - Create Incident)

sruthig
Tera Expert

Hi All,

How to set incident priority from email subject (Inbound Action - Create Incident)?

Please find the below email subject :

Detailed Notification - XXXX- Priority - 2 - High - Moderate- Ticket number - INC00001- Offense ID - 11111

OR Do we need to use use colon separate as like below

Company: XXXX - Priority : 2 - High - Moderate - Ticket number: INC00001 - Offense ID:11111

Please help me to get the subject line format and how to set it priority from subject line also?

Regards,

sruthi

 

1 ACCEPTED SOLUTION

Willem
Giga Sage
Giga Sage

Priority is a calculated field. So based on the priority from the email, you should set the Impact and Urgency on the incident. You can do this using the following format. Add this to your existing inbound action script:

You can add as many else if statements as you have priorities

if (email.subject != undefined) {
    if (email.subject.indexOf('priority - 2') != -1){
        //OOTB impact 1 and urgency 2 = priority 2
        current.impact = 1;
        current.urgency = 2;
    }
    else if (email.subject.indexOf('priority - 3') != -1){
        //OOTB impact 1 and urgency 3 = priority 3
        current.impact = 1;
        current.urgency = 3;
    }
    else if(){
        
    }
}

 

View solution in original post

4 REPLIES 4

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi Sruthi,

please try to use the code described in the below thread:

https://community.servicenow.com/community?id=community_question&sys_id=c27193f9db7b9fc054250b55ca96...

Hope this can fit your need.

If I have answered your question, please mark my response as correct and/or helpful.

Thank you very much

Cheers
Alberto

Hi Alberto,

Thank you for the response.

I have to set priority field from Subject line of an email not from body or email importance of the email.

Regards,

sruthi

Willem
Giga Sage
Giga Sage

Priority is a calculated field. So based on the priority from the email, you should set the Impact and Urgency on the incident. You can do this using the following format. Add this to your existing inbound action script:

You can add as many else if statements as you have priorities

if (email.subject != undefined) {
    if (email.subject.indexOf('priority - 2') != -1){
        //OOTB impact 1 and urgency 2 = priority 2
        current.impact = 1;
        current.urgency = 2;
    }
    else if (email.subject.indexOf('priority - 3') != -1){
        //OOTB impact 1 and urgency 3 = priority 3
        current.impact = 1;
        current.urgency = 3;
    }
    else if(){
        
    }
}

 

Hi Willem,

Thanks for the response.

I had used below condition in my inbound action. It's working as expected.

if (email.subject.indexOf("Priority - 1") >= 0)
{
current.impact = 1;
current.urgency = 1;
}
else if (email.subject.indexOf("Priority - 2") >= 0)
{
current.impact = 1;
current.urgency = 2;
}

Thanks 

Sruthi