- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 12:53 AM
How to send a notification to created by instead of assigned to not provided. Can anyone help me on the email script?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 02:15 AM
hello
we cannot set TO address from email script there are no OOB methods i guess.
we can only set CC and BCC.
One work around is we can use event mechanism to set the TO address
you can create a event in event registry table and write a script like below in a BR on release table with your conditions and it can be an after insert BR
if(current.assigned_to=="")
{
var gr = new GlideRecord('sys_user');
gr.addQuery('user_name',current.sys_created_by);
gr.query();
if(gr.next())
{
gs.eventQueue('your_event_name',current,gr.sys_id,'');
}
}
else
{
gs.eventQueue('your_event_name',current,current.assigned_to,'');
}
And in your notification change the trigger condition to event and give your event name so that when this event fires it sends the notification.
Also you need to check Recipient contains parm1 check box in the who will receive tab
hope this helps
please mark my answer correct if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 01:22 AM
You can achieve this without email script because Created By field is an OOTB field which you will see in in every table in the platform. So use Users/Groups in fields in your email notification configuration and select the field Created by
Please refer to the screenshot below
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 02:08 AM
Hi,
Actually my table is Release[rm_release]. The notification send to assigned to , if assigned to is not provided then only send to created by. how to write the email script for that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 02:15 AM
hello
we cannot set TO address from email script there are no OOB methods i guess.
we can only set CC and BCC.
One work around is we can use event mechanism to set the TO address
you can create a event in event registry table and write a script like below in a BR on release table with your conditions and it can be an after insert BR
if(current.assigned_to=="")
{
var gr = new GlideRecord('sys_user');
gr.addQuery('user_name',current.sys_created_by);
gr.query();
if(gr.next())
{
gs.eventQueue('your_event_name',current,gr.sys_id,'');
}
}
else
{
gs.eventQueue('your_event_name',current,current.assigned_to,'');
}
And in your notification change the trigger condition to event and give your event name so that when this event fires it sends the notification.
Also you need to check Recipient contains parm1 check box in the who will receive tab
hope this helps
please mark my answer correct if this helps you