email notification must include client timezone , wrote a email script on case table to fetch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 02:20 AM
client timezone must be seen on the notification wrote the email script but still not able to print the timezone for client it is showing ist only. I have took details from case table and fetching the contact. so that can print their timezone using email script::
var con = current.contact; // Assuming 'contact' is a reference field on the current record pointing to 'sys_user'
var grt = new GlideRecord('customer_contact');
grt.addQuery('sys_id', con);
grt.query();
if (grt.next()) {
var timezone = Packages.java.util.TimeZone.getTimeZone(grt.time_zone);
var gdt = new GlideDateTime(); // Use current date and time
gdt.setTZ(timezone);
template.print("Date and Start Time: " + gdt.getDisplayValue());
} else {
gs.error("User not found with sys_id: " + con);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 05:39 AM
Hi @kalakaramad_20 ,
It seems like there might be an issue with how the email script is trying to fetch and display the client's timezone. The script appears to be on the right track, but let's make a few adjustments to ensure it works correctly:
// Assuming 'contact' is a reference field on the current record pointing to 'sys_user'
var con = current.contact;
var grt = new GlideRecord('customer_contact');
grt.addQuery('sys_id', con);
grt.query();
if (grt.next()) {
var timezone = grt.time_zone.toString(); // Assuming 'time_zone' is the field storing timezone as a string
var gdt = new GlideDateTime(); // Use current date and time
gdt.setTZ(timezone);
template.print("Date and Start Time: " + gdt.getDisplayValue());
} else {
gs.error("User not found with sys_id: " + con);
}
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 05:47 AM
Hey made the changes as per you provided but seems it is not working yet.