Retrieve sender's mail ID from escalation mail and populate in incident form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2024 07:56 AM - edited 07-12-2024 07:59 AM
I have a task where, when an user escalates an incident to "escalations@abc.com", I need to get the sender's email address from the mail and and populate the value in "sender mail" field of the incident form.
I don't have any idea to implement this. I was advised to create an Inbound email action and test this by creating an email record directly into the 'sys_email' table. Is this a correct way to achieve the requirement? If so, how can we test it?
It would be helpful if anyone could guide me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2024 09:03 AM
Hi @GnaneshP
Create a New Inbound Email Action:
- Define the conditions under which this action should trigger (e.g., when an email is sent to escalations@abc.com).
- Write below like code
(function runMailScript(email, template, incomingEmail) {
var senderEmail = email.headers.from;
var gr = new GlideRecord('incident');
if (gr.get('YOUR_INCIDENT_SYS_ID')) { // Replace with actual incident record retrieval condition
gr.sender_mail = senderEmail;
gr.update();
}
})(email, template, incomingEmail);
Regards,
Sid