Notification on custom table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2023 03:20 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2023 04:24 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2023 06:03 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2023 06:02 AM
hello Namrata,
I tried retrieving the first name from sys_user table with respect to u_requested_for but get empty