<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to Send a notification to created by using email script in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849915#M506841</link>
    <description>&lt;P&gt;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 &lt;STRONG&gt;Users/Groups in fields&lt;/STRONG&gt; in your email notification configuration and select the field &lt;STRONG&gt;Created by&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Please refer to the screenshot below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/46087i87A6652A3B608917/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2022 08:22:58 GMT</pubDate>
    <dc:creator>Vasantharajan N</dc:creator>
    <dc:date>2022-09-01T08:22:58Z</dc:date>
    <item>
      <title>How to Send a notification to created by using email script</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849912#M506838</link>
      <description>&lt;P&gt;How to send a notification to created by instead of assigned to not provided. Can anyone help me on the email script?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 07:53:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849912#M506838</guid>
      <dc:creator>PRAGHATIESH S</dc:creator>
      <dc:date>2022-09-01T07:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to Send a notification to created by using email script</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849913#M506839</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;your email is on which table?&lt;/P&gt;
&lt;P&gt;If it has opened_by field then use that.&lt;/P&gt;
&lt;P&gt;If not then you will have to use event queue approach and trigger email via After insert BR on that table&lt;/P&gt;
&lt;P&gt;Notification: Link with Event, Event parm1 contains Recipient - True&lt;/P&gt;
&lt;P&gt;BR Script:&lt;/P&gt;
&lt;P&gt;gs.eventQueue('event_name', current, gs.getUserID());&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 07:59:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849913#M506839</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2022-09-01T07:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to Send a notification to created by using email script</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849914#M506840</link>
      <description>&lt;P&gt;In the email script below&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var gr=new GlideRecord('sys_user');
gr.get('user_id',current.sys_created_by);
email.addAddress("to",gr.email,gr.name);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="http://www.john-james-andersen.com/blog/service-now/send-new-servicenow-users-a-welcome-email-with-credentials.html"&gt;http://www.john-james-andersen.com/blog/service-now/send-new-servicenow-users-a-welcome-email-with-credentials.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 08:15:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849914#M506840</guid>
      <dc:creator>Upender Kumar</dc:creator>
      <dc:date>2022-09-01T08:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to Send a notification to created by using email script</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849915#M506841</link>
      <description>&lt;P&gt;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 &lt;STRONG&gt;Users/Groups in fields&lt;/STRONG&gt; in your email notification configuration and select the field &lt;STRONG&gt;Created by&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Please refer to the screenshot below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/46087i87A6652A3B608917/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 08:22:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849915#M506841</guid>
      <dc:creator>Vasantharajan N</dc:creator>
      <dc:date>2022-09-01T08:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to Send a notification to created by using email script</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849916#M506842</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Actually my table is Release[rm_release]. The notification send to assigned to , if assigned to not provided&amp;nbsp; then only send to created by. how to write the email script for that?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 08:52:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849916#M506842</guid>
      <dc:creator>PRAGHATIESH S</dc:creator>
      <dc:date>2022-09-01T08:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Send a notification to created by using email script</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849917#M506843</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Actually my table is Release[rm_release]. The notification send to assigned to , if assigned to is not provided&amp;nbsp; then only send to created by. how to write the email script for that?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 09:08:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849917#M506843</guid>
      <dc:creator>PRAGHATIESH S</dc:creator>
      <dc:date>2022-09-01T09:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to Send a notification to created by using email script</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849918#M506844</link>
      <description>&lt;P&gt;hello &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="d34d949fdb0d9d50904fa9fb13961988"&gt;@PRAGHATIESH S&lt;/SN-MENTION&gt; ,&lt;/P&gt;
&lt;P&gt;we cannot set TO address from email script there are no OOB methods i guess.&lt;/P&gt;
&lt;P&gt;we can only set CC and BCC.&lt;/P&gt;
&lt;P&gt;One work around is we can use event mechanism to set the TO address&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can create a event in event registry table and write a script like below in a BR&amp;nbsp; on release table with your conditions and it can be an after insert BR&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;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,'');

}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;Also you need to check &lt;EM&gt;&lt;STRONG&gt;Recipient contains parm1 check box&amp;nbsp; in the who will receive tab&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;hope this helps&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;please mark my answer correct if this helps you&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 09:15:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849918#M506844</guid>
      <dc:creator>Mohith Devatte</dc:creator>
      <dc:date>2022-09-01T09:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to Send a notification to created by using email script</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849919#M506845</link>
      <description>&lt;P&gt;Hi &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="d34d949fdb0d9d50904fa9fb13961988"&gt;@PRAGHATIESH S&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I already said you cannot include created by in email directly.&lt;/P&gt;
&lt;P&gt;You will have to use gs.eventQueue() approach which I already shared as 1st response to your question.&lt;/P&gt;
&lt;P&gt;Did you mistakenly marked other response as correct?&lt;/P&gt;
&lt;P&gt;You just had to enhance the script I shared&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;if(current.assigned_to)
	gs.eventQueue('event_name', current, current.assigned_to);
else
	gs.eventQueue('event_name', current, gs.getUserID());&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Would you mind marking appropriate response as correct based on timely response?&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 11:15:30 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-send-a-notification-to-created-by-using-email-script/m-p/1849919#M506845</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2022-09-01T11:15:30Z</dc:date>
    </item>
  </channel>
</rss>

