Notification on custom table

Nisha B
Tera Expert

Hello All,

I want to set up notification on custom table which have the RITM number , Change request and Change task , Requested for this all are string field , so when the record in custom table status mark as failed , i need to trigger a mail to Requested For , Now here requested for is a string field which holds the user id .

I am not getting how to bring this requested for in CC as this is a string filed we need to populate the email with respect to User ID present in Requested For field and this requested for should come like Dear ${Requester}

 

Please help on this.

 

Thanks 

7 REPLIES 7

Hello Namrata,

Yes it is working but now , what I am looking for from above script I need to return the Full name also for requested For and it should appear in message body of Notification as-

 Dear${Requested for}

I believe I have to call mail script?

Hi @Nisha B ,

In your email script add code like below.

var requestedFor=current.u_requested_for; 
var grUser=new GlideRecord('sys_user');
grUser.addQuery('name',requestedFor);//if sysid is in Requestedfor field then use grUser.addQuery('sys_id',requestedFor);
grUser.query();
if(grUser.next())
{
email.addAddress("cc",grUser.email,grUser.name);
template.print("Dear "+grUser.getValue('name'));
}

and in your email notification body call the email script like below

${mail_script:yourEmailScriptName}

 

Please mark my answer as helpful and correct if it helps you.

Regards,

Namrata

 

hello Namrata,

I  tried retrieving the first name from sys_user table with respect to u_requested_for but get empty 

 


    var requestedFor=current.u_requested_for; 
var grUser=new GlideRecord('sys_user');
grUser.addQuery('user_name',requestedFor);//if sysid is in Requestedfor field then use grUser.addQuery('sys_id',requestedFor);

grUser.query();
if(grUser.next())
{
email.addAddress("cc",grUser.email,grUser.name);
template.print("Requester : "+grUser.first_name);
}
please help me to correct this