ServiceNow has a pretty simple one-way Outlook calendar integration that you can use to send out iCal meeting requests and updates to assignees involved with a Change request. I’m often asked if this functionality can be used for meeting invites in other tables as well. The answer is Yes! This hasn’t really been documented because it relies on some legacy technology that really isn’t that prominent in the system anymore. In this article, I’ll show you the pieces that make this calendar integration work by showing you how to set the integration up for the change task table.
The out-of-box iCalendar integration for Change requests relies on a few different pieces. Most of the pieces are actually standard email notification business rules, events, and templates. The real mystery to this integration lies in the start/end date mappings for the meeting request. These are important because they define the fields on the task that the email template pulls its dates from. Once you get this set up correctly all you’ve really got to do is set up some standard email notifications with a template that I’ll show you below.
Setting up the start/end date field mappings
–Navigate to the legacy ‘Import Export Map’ table by typing ‘sys_impex_map.list’ in your left navigation filter.
–We’ll create a new entry that ends up looking like this…
–Create the map entry as shown in the image above
–Click the ‘New’ button on the ‘Field maps’ related list to create 2 field maps for your start and end dates
–Select the ‘Mapping to a database field’ option from the wizard
–Map your start and end dates as shown in the images below. For the Change task table, I’ve decided to use the ‘Expected start’ field for my start date and the ‘Due date’ field my end date. You MUST use ‘dtstart’ and ‘dtend’ for the external names for iCalendar integrations.
Once you’ve got the legacy Import/Export map configured, the rest is really just a standard email notification setup. You’ll need an event trigger, an event, and a notification that responds to that event. I’m not going to go over the specifics of setting up an email notification here. You can reference the ServiceNow wiki for that.
The out-of-box Change request setup uses a section of code in the ‘change events’ business rule. Even though you can trigger an event from lots of different places in the system, I think the business rule setup is going to work the best for most scenarios. The great thing about borrowing the code from the Change request table is that it already takes care of all of the different conditions for you. All you have to do is modify the field and event names in the script to go with your custom setup. I’ve modified the below to work with the ‘Expected start’ and ‘Due date’ fields from the Change task table. I’ve also modified the script to trigger 2 new events (which you’ll need to create), called ‘change_task.calendar.notify’ and ‘change_task.calendar.notify.remove’.
Name: change_task send icalendar
Table: change_task
When: after
Insert/Update: true
Script:
if (!current.expected_start.nil() && !current.due_date.nil() && !current.assigned_to.nil()) {
gs.eventQueue("change_task.calendar.notify", current, current.assigned_to, previous.assigned_to);
}// Remove from previous assigned to, due to assigned_to changing
if (!previous.assigned_to.nil()) {
if (!current.assigned_to.nil() && current.assigned_to.changes() &&
(!previous.expected_start.nil() && !previous.due_date.nil())) {
gs.eventQueue("change_task.calendar.notify.remove", current, current.assigned_to, previous.assigned_to);
}
}
// Remove old calendar from current assigned to, due to date changing
else if (!current.assigned_to.nil()) {
if ((current.expected_start.changes() && !previous.due_date.nil()) ||
(current.expected_start.changes() && !previous.due_date.nil())) {
gs.eventQueue("change_task.calendar.notify.remove", current, current.assigned_to, current.assigned_to);
}
}
}
Once you set up your event trigger and corresponding events, you need to set up your notifications to be triggered by those events.
The final step then (and probably the most important) is to set up your email messages or templates. Again, I’m not going to go into specifics here about how to set up an email notification. It doesn’t matter if set up your message in the notification or template, but since the out-of-box Change request iCal setup has this in email templates I’ve decided to do the same for this one for consistency. The ‘Subject’ here is strictly a label. The real subject is actually populated through the ‘Summary’ line in the body of the email.
If you’ve set up your variable mappings correctly in the steps above you shouldn’t have to customize this piece at all. Just paste the contents of each of the sections below into the ‘Message’ box on your notification or template setup, set the correct table, and go. You’ll most likely want to have 2 notifications, one for an event request and one for cancellation.
If you need a guide you can look at the ‘Notify Change Calendar’ and ‘Notify Change Calendar Remove’ Email Notifications on the ‘change_request’ table (along with their associated templates).
‘change_task.calendar.integration’ Email Templates
Calendar invite template
Name: change_task.calendar.integration
Table: change_task
Subject: SPECIAL CASE TEMPLATE — Push change tasks into an outlook calendar
Message:
PRODID:-//Service-now.com//Outlook 11.0
MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:${to}
ORGANIZER:MAILTO:${from}
DTSTART:${dtstart}
DTEND:${dtend}
LOCATION:${location}
TRANSP:OPAQUE
SEQUENCE:${sys_mod_count}
UID:${uid}
DTSTAMP:${dtstamp}
SUMMARY:${summary}
DESCRIPTION:${description}
PRIORITY:${priority}
X-MICROSOFT-CDO-IMPORTANCE:${priority}
STATUS:CONFIRMED
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR
Calendar cancellation template
Name: change_task.calendar.integration.remove
Table: change_task
Subject: SPECIAL CASE TEMPLATE — Push change tasks into an outlook calendar
Message:
PRODID:-//Service-now.com//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:CANCEL
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:${to}
ORGANIZER:MAILTO:${from}
LOCATION:${location}
TRANSP:OPAQUE
DTSTART:${dtstart}
DTEND:${dtend}
SEQUENCE:${sys_mod_count}
UID:${uid}
DTSTAMP:${dtstamp}
DESCRIPTION:${description}
SUMMARY:${summary}
PRIORITY:${priority}
X-MICROSOFT-CDO-IMPORTANCE:${priority}
STATUS:CANCELLED
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR
That’s it! If you’ve done everything correctly you should be able to send calendar invites from your change task table just like you can for change requests.
Can I send To Do Tasks or Notes too?
ServiceNow can send them if you modify the email template with the correct ‘VTODO’ or ‘VJOURNAL’ tags, but most email clients (including all from Microsoft) don’t support it. So, you can send all day, but chances are your email client won’t handle it!
Good stuff Mark, just what I was looking for.
Thanks!
Fred K.
Does this work for non-task tables? I’m assuming yes…
I haven’t tested it personally, but I would assume that it would work the same way for non-task tables.
Hello,
Is there other methods than REQUEST and CANCEL?
For example modify? In outlook you can just modify the date-time of an event.
Is there a way to make it through email?
Thanks, Manolis
None that I’m aware of. There’s not much flexibility with these unfortunately.
I have one remark regarding the code in the BR.
In the case that the Assigned to does not changes but the start_date or end_date changes (or both start and end), then the event for “change.calendar.notify” will be fired but the “change.calendar.notify.remove” will be not. That means the Assigned to will have 2 events on his calendar for the same change.
Regards, Manolis.
Hello,
I have the same issue. How to solve or is there any workaround?
Regards, Nicolas.
Hello, for information there is a workaround suggested here: http://community.servicenow.com/forum/13867
I tried this for our sc_task table to send meeting requests for Tasks within the Service Catalog. I changed all references above from the change_task table to the sc_task table, but the meeting requests are still not working. I have triple checked my field map entry, business rule, event registry, and email notificaitons/templates and can’t find an error. The only thing I can think of is that I am using the incorrect table? This should work for any task in the Service Catalog if I use sc_task, correct?
Thanks,
Darcie
Should be almost the exact same setup (substituting ‘sc_task’ for ‘change_task’) as outlined here. You should confirm first off that this works correctly for change requests. If it does then you’ll need to review the ‘sc_task’ configuration again.
Thanks Mark for the quick response! I will double check change requests and keep trying!
I tried mapping start and end times on a table that we created and used ‘dtstart’ and ‘dtend’ as the external names. When I try to use those variables in the related meeting invitation the current date/time is inserted and not the date/time defined in the map. Any ideas for why that might be happening?
@Ken, I’m not sure why that would happen. The only thing I would suggest would be to test and make sure it sends properly for the out-of-box ‘change_request’ notifications. I’ve just re-run a quick test using the instructions outlined in this article and it seems to work just fine for me.
Ken, Mark,
I tried this setup on a table derived from Task and non-Task table with the same result: the Outlook meeting is created with the current date.
It works well with on the Change Request table.
Thank you Mark for the invaluable help that you bring to the Service-now community.
François
FYI, The ICS wiki article has been pulled.
Thanks Valor. I’ve removed the reference from my article.
I am having the same issue as Tolgyesi. The date always shows the current date and it also defaults to a 30 minute or 60 minute time frame. We’ve double checked and triple checked all settings.
Our Calendar works perfect. This is happening in Dev and Prod.
I went as far as creating custom tables for the date on the form.
If anyone has any advice it is most welcome.
Thanks!
Hello Johnny,
We have solved this issue with a very strange workaround.
If I remember well, we changed the “mapped field” type from “field” to “var”, and back, and as strange as it appears, that solved my issue..
Hope this help
François
I am also having the same problem in which the event start time is the time the email was sent and the end time is always 30 min later. Has anyone figured out a way around this?
Unfortunatly the workaround proposed by Tolgyesi didn’t work at my instance. @Jesse, dit you find a solution?
Bas,
No solution found yet. I mentioned it to service now, and they had no idea what I was talking about. Hopefully this is something that gets fixed in the upcoming Dublin release.
One of my colleagues came up with a solution; I’ll ask him about what he did.
Don’t count on ServiceNow “fixing” this–we submitted an Incident for one of our customers and they wrote back saying it was unsupported.
Hi Valor,
Please share the fix, i having the same issue which the event start time is request time date and end date is always is30 mins later.
Actually i tried to send the calendar notification based on the request variable by using the sc_req_variables. i created import export mapping in sc_req_variables mapping field as question
Thanks
Senthil.R
Apologies, but I should have posted earlier. I have had this working now for quite some time.
If anyone wants details, feel free to reply to the thread and I can forward instructions.
Please share the details here or send them to me if what you had to do is different than described in this post. That way, everyone can benefit from the solution.
Any update on this? I am having the same issue in which the event start time is the time the email was sent and the end time is always 30 min later. Please Help
I was having the same issue and found it was due to not naming my Import Export Map correctly. The mapping must be named “icalendar.” or it will not work. I found this in http://wiki.servicenow.com/index.php?title=Email_Templates#Creating_iCalendar_Invitations_for_Custom_Tables.
Hopefully this helps some of you having the same issue.
If it is sending from now until 30 minutes later, the name of your sys_impex_map record is wrong. It HAS to be
icalendar.{table_name} so therefore there can only be one record per table in the sys_impex_map table.
Hope this helps!
The issue with time can be resolved by mapping a beginning and end time.
In our instance I created date fields on the Task Form named Begin Time and Date and End Time and Date.
Navigated to sys_impex_map.list
Mapped Name: icalendar.sc_task
Mapped Table: Catalog Task
Type: icalendar
Mapped u_end_time_and_date to external name dtend on the sc_task Table.
Mapped u_begin_time_and_date to external name dtstart on the sc_task Table.
Here’s the rest of my work.
Business Rule Created (upon Insert and Update on the Catalog Task Table. Named icalendar.sc_task)
if (current.u_begin_time_and_date.changes() || current.u_end_time_and_date.changes() || current.assigned_to.changes()) {
if (!current.u_begin_time_and_date.nil() && !current.u_end_time_and_date.nil() && !current.assigned_to.nil()) {
gs.eventQueue(“icalender.sc_task.inserted”, current, current.assigned_to, previous.assigned_to);
}
// Remove from previous assigned to, due to assigned to changing
if (!previous.assigned_to.nil()) {
if (!current.assigned_to.nil() && current.assigned_to.changes() &&
(!previous.u_begin_time_and_date.nil() && !u_end_time_and_date.nil())) {
gs.eventQueue(“icalender.sc_task.updated”, current, current.assigned_to, previous.assigned_to);
}
}
// Remove old calendar from current assigned to, due to date changing
else if (!current.assigned_to.nil()) {
if ((u_begin_time_and_date.changes() && !previous.u_end_time_and_date.nil()) ||
(current.u_end_time_and_date.changes() && !previous.u_end_time_and_date.nil())) {
gs.eventQueue(“icalender.sc_task.notify.remove”, current, current.assigned_to, current.assigned_to);
}
}
}
Event Registry Entries Created on the Catalog Task Table named icalender.sc_task.inserted, icalender.sc_task.updated and icalender.sc_task.remove
Email Template for New Invite and when time changes it sends an updated invite…
BEGIN:VCALENDAR
PRODID:-//Service-now.com//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:company@service-now.com
ORGANIZER:MAILTO:company@service-now.com
DTSTART:${dtstart}
DTEND:${dtend}
LOCATION:${location}
TRANSP:OPAQUE
SEQUENCE:${sys_mod_count}
UID:${sys_id}
DTSTAMP:${dtstamp}
DESCRIPTION:${description}
SUMMARY:${summary}
PRIORITY:5
X-MICROSOFT-CDO-IMPORTANCE:1
CLASS:PUBLIC
Template for Cancel
BEGIN:VCALENDAR
PRODID:-//Service-now.com//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:CANCEL
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:wagged@service-now.com
ORGANIZER:MAILTO:wagged@service-now.com
DTSTART:${dtstart}
DTEND:${dtend}
LOCATION:${location}
TRANSP:OPAQUE
SEQUENCE:${sys_mod_count}
UID:${sys_id}
DTSTAMP:${dtstamp}
DESCRIPTION:${description}
SUMMARY:${summary}
PRIORITY:5
X-MICROSOFT-CDO-IMPORTANCE:1
CLASS:PUBLIC
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR
Triggered Email Notifications using insert of time on said fields on form, update to fields and when some chooses cancel as the category.
Hi all, I’ve tried several scenarios today:
1. Send ‘out of the box’ Change Request notification with standard field mapping => OK
2. Send ‘out of the box’ Change Request notification using custom date/time fields (u_start & u_end) on the CR record => OK
3. Send new Incident notification using custom date/time fields (u_start & u_end) on the CR record => OK
4. Create custom table, which extends the Task table, having custom fields (u_start & u_end) => NOT OK
5. Create custom table, which does not the Task table, having custom fields (u_start & u_end) => NOT OK
I’ve used the “Insert & Stay” approach to exactly copy all required records (sys_impex mapping, notification, template) and so far I can conclude that this functionality is not working for custom tables. I will try to get some help from ServiceNow; hopefully they can help us out.
Regards,
Bas
I’m having the same issue. Did you ever come up with a solution?
I’m attempting to set up a iCalendar invite in an email message purely within the Email Notification record (aka WITHOUT using the email template). This is NECESSARY if you want to send 2 different meeting invites from the same table – you can only use the method suggested on the ServiceNow wiki if you have a single meeting time per table, as there can be only one DTSTART and DTEND auto-mapped per table.
I was hoping to use a mail script to do this, which needs to be done in the email notification (since mail scripts don’t work in templates).
However, I can’t get a correct iCalendar invite to go out using just the email notification, even when I hard-code everything in it to a plain-text (non-scripted) calendar invite! It says in this article that it’s possible…
Email notification Options:
Type is Meeting Invitation, the content type is HTML and plain text, and I’m omitting the watermark.
Every time the iCalendar email I attempted to create is sent out, the message body is blank.
(In WORKING iCalendar emails using the email template method, the message body is NOT blank.)
We’re running Calgary.
Has ANYONE managed to get an iCalendar invite sent out correctly if just using the email notification and NOT using an email template?
Thanks!
-Rita
I’ve been struggling with iCalendar integrations on custom (non-task) tables tonight myself. It appears the wiki has been updated with more specific working instructions, and the naming of the sys_impex_map entry is crucial to getting the calendar time correct. On Dublin/Eureka, the listed instructions should work correctly, according to my tests – follow them closely!
http://wiki.servicenow.com/index.php?title=Email_Templates#Creating_iCalendar_Invitations_for_Custom_Tables
I have customized meeting invitations for change to be sent to watchlist as well. Can anyone tell me how the Required person is selected for the invitation sent. I recently found a scenario where some one else was in Required field.