The CreatorCon Call for Content is officially open! Get started here.

Variables change off of inbound action keywords in body of email.

Justin Dirks1
Tera Expert

Hello!

 

I am needing to change a variable in an incident based on the keywords of High or significant within the body of an email. If the email contains Severe then I would want to have the Priority changed to 1-High and if the body contains Warning I would want the Priority to be set to 2-Significant.

 

Any help with this would be great!

 

Thanks!

1 ACCEPTED SOLUTION

So I was able to get Critical to work but not what I needed for Warning. 

 

var emailBody = email.body;

	if (emailBody.indexOf ("Critical") != -1) {

		current.impact = 1;
		current.urgency = 1;

	} else if (emailBody.indexOf ("Warning") != -1) {
		
		current.impact = 1;
		current.urgency = 2;
	}


	current.insert();

 

 

View solution in original post

12 REPLIES 12

Please check the "Priority Data Lookups" in your system and validate the impact & urgency for desire priority value. Set for same impact & urgent in code. 

 

AshishKMishra_0-1699996696606.png

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

It seems to be failing at the Warning level. I changed it to impact = 2 and urgency = 2 and it is still making the impact and urgency a 1. 

 

Do you have any other configuration setting for impact & urgency based on some other form field like category or sub-category ( from sys_choice ) table or configuration item level. Something is already define which is not allowing to edit. 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

we don't have anything going on in the background that should change this. Here is my full script 

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

	current.caller_id = gs.getUserID();
	current.short_description = email.subject;
	current.description = "received from: " + email.origemail + "\n\n" + email.body_text;
	
	current.category = "software";
	//current.impact = "1";
	//current.urgency = "2";
	current.cmdb_ci.setDisplayValue('hostname');
	current.assignment_group.setDisplayValue('Network Administrators');

	
	current.incident_state = IncidentState.NEW;
	//current.notify = 2;
	current.contact_type = "System-generated";
	
var emailBody = email.body;

	if (emailBody.indexOf ("Critical") != -1) {

		current.impact = 1;
		current.urgency = 1;

	} else if (emailBody.indexOf ("Warning") != -1) {
		
		current.impact = 1;
		current.urgency = 2;
	}


	current.insert();


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

apply the gs.log() and check if flow going in "Warning" condition and also check the incident activity log if there is any update details recorded 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution