Inbound Email Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2015 01:56 AM
Hello everyone,
I create one custom date field in incident form. I want to set the email date timing to my incident date field.
I am trying this but this is not working,
current.u_date = email.date;
current.short_description = email.subject;
Thanks
Ankul Agrawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2015 01:23 AM
I don't think email.date is available. Inbound Email Actions - ServiceNow Wiki
There is email.headers variable is available and headers contains date. So first get the header value and split it to get the date then parse it to date object before setting it in your date field.
Example:
var emailHeader=email.headers;
var emailDateSplit=emailHeader.split("Date:");
-----------
---------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2015 07:17 AM
Hi Ankul,
If you just want the email date to be updated in a field in the incident table then just write.
current.u_date = gs.now();
This will fetch the current date and put it in the field.
This should serve your purpose, rather than extracting the date from the mail, as the mail will get processed on the same date when it is received.
Regards
Pratul Agarwal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2015 09:34 AM
Hi Ankul,
I use the same method as Pratul. But depending on your needs, you have to be aware that gs.now() is never exactly the same as the date-time the email was sent / received, especially if there are issues on an mail server somewhere in the chain. It's probably good enough in most circumstances though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2015 01:06 PM
Hi ankul,
You should be able to use the global variable sys_email.
In your case it should be something like:
current.u_date = sys_email.sys_created_on;
current.short_description = email.subject;
"You can use the global variable sys_email with inbound email actions. This lets you access the received sys_email record that triggered the inbound email action. It can be used to reference fields on the email record, such as uid, sys_id, content_type, and so on."
From nr.15 here : Inbound Email Actions - ServiceNow Wiki