- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 03:08 PM
Hello Guys, I was attempting to pull a specfic line after the last : that starts with
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 07:18 PM
Can you log the email body to inspect the content you getting in that, Also Depending on the format of your email body, you might need to adjust the regular expression. For instance, if there could be whitespace characters around the = sign or the : sign, you might want to make the expression more flexible.
Please try the updated code below:
var emailBody = email.body_text;
gs.info("Email Body: " + emailBody); // Log the email body to inspect its content
// Adjusted regular expression to be more flexible
var regex = /UniqueFailureID\s*=\s*.*:([a-f0-9\-]+)$/im;
var match = emailBody.match(regex);
if (match && match[1]) {
var uniqueFailureID = match[1];
current.u_uniquefailureid = uniqueFailureID;
current.update();
} else {
gs.log("UniqueFailureID not found in the email body for incident: " + current.number, "Inbound Email Action AAC_Automation");
}
lease Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 07:20 AM
This worked, Thank you sir, i was able to get the info populated into the variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 07:45 PM
Probably, it's an issue with your email body. May be a whitespace is creating a problem. I tried your script on my PDI with a sample email body and it is working as expected. Refer below screenshots :
Can you try to log the email body and see if you are getting it as expected or not ?
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.