I need to update the email-generated incidents priority

praveenkumarr
Tera Expert

Hi Team,

I need to update the email-generated incident priority. Initially  it was in Priority P5 i need to update the Priority to P4 also for one particular Email-generated. I had checked the inbound actions as well.

could anyone please help us for update the Priority of incidents .

 

Thanks in advance,

Praveen Kumar

1 ACCEPTED SOLUTION

Hi sanjay ,Thanks for Responding.

I have this code , I am updated "urjency & impact" as you mentioned in Inbound email action but it was not updating as per my requirement.

 

Can you suggest any other update.

 

Thanks ,

Praveen

 

View solution in original post

5 REPLIES 5

Yashsvi
Kilo Sage

Hi @praveenkumarr,

Create Business Rule:

(function executeRule(current, previous /*null when async*/) {
    if (current.source == 'Email') { // Adjust condition based on your setup
        current.priority = '4'; // Adjust priority value (e.g., '4' for P4)
    }
})(current, previous);

Thank you, please make helpful if you accept the solution.

praveenkumarr
Tera Expert

Hi Yashvi , Thanks for  a prompt response.

From where the functionality will work it is from business rules or Inbound actions because we can use the existing one right so.

Would you please provide me with clarification?

 

Thanks,

Praveen

Hi @praveenkumarr,

update the priority of incidents specifically when they are email-generated, you would typically use a Business Rule. This is because you're likely updating the priority based on conditions that can be evaluated when the incident record is created or updated.

Business Rule: You create a Business Rule that triggers on insert (when a new incident is created) or update (when an existing incident is modified). In this rule, you would check if the incident was generated from email (based on a field like source). If it meets the criteria (e.g., source == 'Email'), you then update the incident's priority field accordingly (current.priority = '4'; for P4, for example).

Thank you, please make helpful if you accept the solution.

Sanjay Bagri1
Tera Guru

Hello Praveen,

 

ServiceNow Provided OOB code for Create incident with some default values so can you update the Impact and urgency on your code. Like Below  code and see the commented line with your name.

 

//	Note: current.opened_by is already set to the first UserID that matches the From: email address

current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;

current.category = "inquiry";
current.incident_state = IncidentState.NEW;
current.notify = 2;
current.contact_type = "email";

if (email.body.assign != undefined)
   current.assigned_to = email.body.assign;


// Praveen Please using the below line of code and update the impact and urgency as per your requirment so it will //update the Priority automatically. 

if (email.importance != undefined) {
   if (email.importance.toLowerCase() == "high") {
		current.impact = 1;   
		current.urgency = 1;
   }
}

if (current.canCreate())
	current.insert();

 

 

If my answer helped you in any way, please then mark it as helpful or correct.