Solving iCalendar Invite Formatting Issues in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 09:40 AM
If you’re a ServiceNow developer, you might have faced issues with calendar invites displaying incorrect dates. This commonly occurs because iCalendar’s dtstart and dtend fields require dates in the format YYYYMMDDTHHMMSSZ, whereas ServiceNow DateTime fields use YYYY-MM-DD HH:MM:SS. Here’s how to address this issue:
Solution:
Create an iCalendar Entry in sys_impex_map:
- Navigate to the sys_impex_map table and create a new entry for the relevant table (e.g., icalendar.change_request).
- Choose iCalendar as the type.
Map Date Fields:
- Map dtstart to the corresponding start date field (e.g., planned_start_date).
- Map dtend to the corresponding end date field (e.g., planned_end_date).
This mapping ensures that the dates are formatted correctly (YYYYMMDDTHHMMSSZ) for iCalendar invites.
Use iCalendar Fields in Email Template:
- In your email template, reference the mapped fields using ${dtstart} and ${dtend}. For example:htmlDTSTART:${dtstart} DTEND:${dtend}
- In your email template, reference the mapped fields using ${dtstart} and ${dtend}. For example:
Test the Calendar Invite:
- Send a test notification to verify that the invite renders correctly in Google Calendar, Outlook, etc.
By following these steps, you’ll ensure that your iCalendar invites display the correct date and time, providing a seamless scheduling experience.
- 569 Views