- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 10:43 AM
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!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 01:14 PM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 01:20 PM
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.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 01:34 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 01:44 PM - edited 11-14-2023 01:46 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 02:01 PM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 02:04 PM
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