Custom TimeZone mapping issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 04:31 AM
Hi,
In ServiceNow, we have a requirement to map custom location time zones to standard out-of-the-box (OOB) time zones. The custom time zone data that we receive from a third-party integration is more similar to country names.
Examples of custom time zone names include: India, Germany, Belarus, AustEast, AustWest, etc. These are few examples and we have a lot of similar data coming into staging table.
We need to map these time zones to standard OOB time zones like IST (Asia/Kolkata), CET, MST, Canada/Pacific, etc.
Has anyone encountered similar requirements and can offer assistance?
Thanks,
Vani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 06:23 AM - edited ‎04-07-2025 06:24 AM
Hello @Kokila Vani ,
If scripting is involved in transforming the staging data to the target table you could simply map the time zones like this:
function getTimeZoneName(country) {
var defaultTimeZone = 'GMT';
var timeZoneMap = {
'India': 'IST (Asia/Kolkata)',
'Germany': 'CET'
// add more mappings as needed
};
return timeZoneMap[country] || defaultTimeZone;
}
gs.info(getTimeZoneName('India'));
gs.info(getTimeZoneName('France'));
Output:
IST (Asia/Kolkata)
GMT
But if you have dozens of different countries coming from the integration, or you are looking for something that is reusable and maintainable you might want to store these mappings in a custom table.
Regards,
Robert