How to get the ritim varable value on the notification template

Alex78
Tera Contributor

 

Hi Team, Good morning!

How to get the item variable value on the notification template?
there is a variable "Meeting date and time " and then put the value "2023-12-21 12:38:38 and the item ordered then I need to trigger a notification for XYZ group and the body needs to add the meeting time field on the notification and set the value item "meeting date and time" field for the only time.

2 ACCEPTED SOLUTIONS

Hi @Alex78  try below

var time;

var dt = new GlideDateTime( current.variables.m_t); //Replace correct fieldname
var datetimearray = dt.getDisplayValue().split(' ');

time = datetimearray[1]; //returns time

}

template.print(time);

Regards
Harish

View solution in original post

Rajankumar
Giga Expert

Hi @Alex78 ,

Could you please create an Email script, Define this code on the email script, and call on the notification template?

 

var ritm = new GlideRecord('sc_req_item');
    ritm.addQuery("request", current.request.sys_id);
    ritm.query();
    if (ritm.next()) {
    var ritm_time =ritm.variables.meeting_d;
var glideDateTime = new GlideDateTime(ritm_time);
var timeOnly = glideDateTime.getLocalTime().getDisplayValue();

template.print('<div style="font-size: 16px; padding-bottom: 5px; ">' +'Meeting Time : '+ timeOnly+' </div>');

View solution in original post

5 REPLIES 5

Rajankumar
Giga Expert

Hi @Alex78 ,

Could you please create an Email script, Define this code on the email script, and call on the notification template?

 

var ritm = new GlideRecord('sc_req_item');
    ritm.addQuery("request", current.request.sys_id);
    ritm.query();
    if (ritm.next()) {
    var ritm_time =ritm.variables.meeting_d;
var glideDateTime = new GlideDateTime(ritm_time);
var timeOnly = glideDateTime.getLocalTime().getDisplayValue();

template.print('<div style="font-size: 16px; padding-bottom: 5px; ">' +'Meeting Time : '+ timeOnly+' </div>');