<?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 Set From address dynamically in email client template in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3100907#M1606</link>
    <description>&lt;P&gt;Hello I am trying to configure am &lt;STRONG&gt;email client template&lt;/STRONG&gt; where &lt;STRONG&gt;sender address&lt;/STRONG&gt;&amp;nbsp;'&lt;STRONG&gt;From'&lt;/STRONG&gt; has to be dynamically populated based on the &lt;STRONG&gt;Assigned to&lt;/STRONG&gt; field on a &lt;STRONG&gt;case&lt;/STRONG&gt; table. Assigned to a specific user is a &lt;STRONG&gt;reference field&lt;/STRONG&gt; and &lt;STRONG&gt;Email value&lt;/STRONG&gt; has to be fetched from the &lt;STRONG&gt;user&lt;/STRONG&gt; table. I have tried many ways configuring the script include and calling it from email client template (sender configuration) but nothing seems to work out. Can someone provide any workaround on how to achieve this? Thank you&lt;/P&gt;</description>
    <pubDate>Sun, 10 Nov 2024 20:38:22 GMT</pubDate>
    <dc:creator>PrashanthB80186</dc:creator>
    <dc:date>2024-11-10T20:38:22Z</dc:date>
    <item>
      <title>Set From address dynamically in email client template</title>
      <link>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3100907#M1606</link>
      <description>&lt;P&gt;Hello I am trying to configure am &lt;STRONG&gt;email client template&lt;/STRONG&gt; where &lt;STRONG&gt;sender address&lt;/STRONG&gt;&amp;nbsp;'&lt;STRONG&gt;From'&lt;/STRONG&gt; has to be dynamically populated based on the &lt;STRONG&gt;Assigned to&lt;/STRONG&gt; field on a &lt;STRONG&gt;case&lt;/STRONG&gt; table. Assigned to a specific user is a &lt;STRONG&gt;reference field&lt;/STRONG&gt; and &lt;STRONG&gt;Email value&lt;/STRONG&gt; has to be fetched from the &lt;STRONG&gt;user&lt;/STRONG&gt; table. I have tried many ways configuring the script include and calling it from email client template (sender configuration) but nothing seems to work out. Can someone provide any workaround on how to achieve this? Thank you&lt;/P&gt;</description>
      <pubDate>Sun, 10 Nov 2024 20:38:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3100907#M1606</guid>
      <dc:creator>PrashanthB80186</dc:creator>
      <dc:date>2024-11-10T20:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Set From address dynamically in email client template</title>
      <link>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3101189#M1609</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/809038"&gt;@PrashanthB80186&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can add a mailscript which sets the from address.&lt;/P&gt;&lt;P&gt;Within the mailscript you do your magic by retrieviing the desired from address and setting it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;email.setFrom(current.caller_id.email);
email.setReplyTo("joe.employee@yourcompany.com");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More information:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.servicenow.com/docs/bundle/xanadu-platform-administration/page/script/server-scripting/reference/r_MailScriptAPI.html" target="_blank"&gt;https://www.servicenow.com/docs/bundle/xanadu-platform-administration/page/script/server-scripting/reference/r_MailScriptAPI.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps. If it does, please mark as helpful or as solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hayo&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 08:29:12 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3101189#M1609</guid>
      <dc:creator>Hayo Lubbers</dc:creator>
      <dc:date>2024-11-11T08:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Set From address dynamically in email client template</title>
      <link>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3101199#M1610</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/809038"&gt;@PrashanthB80186&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the Send Configuration section on the form of Email Client Template, you can&amp;nbsp;&lt;SPAN&gt;select the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;From Generation Type&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;method to determine how the &lt;STRONG&gt;Sender (From address)&lt;/STRONG&gt; in the email client message is generated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Use this method only if you want a different From address than the one defined in your SMTP email account.&lt;/EM&gt;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;EM&gt;None: The From address isn’t generated in the email client message.&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;SMTP Email Account: Use the From address of the SMTP email account for the instance as the sender.&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;Select From List: Choose from a list of allowable From addresses defined in the Email Client From Address [sys_email_client_from_address] table.&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;Script: Run a GlideRecord query on the Email Client From Address [sys_email_client_from_address] table.&lt;/EM&gt;&lt;DIV class=""&gt;&lt;EM&gt;For example, the following script sets the From address based on the location of the incident caller:&lt;/EM&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;(function (fromAddressQuery, targetRecord) {
    // targetRecord is incident for this template
    var location = targetRecord.caller_id.country;

    if (location == 'us')
        fromAddressQuery.addQuery('email_address', 'servicedesk.us@example.com');
    else if (location == 'japan')
        fromAddressQuery.addQuery('email_address', 'servicedesk.jp@example.com');
    else if (location == 'uk')
        fromAddressQuery.addQuery('email_address', 'servicedesk.uk@example.com');

})(fromAddressQuery, targetRecord);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;Text: Enter the email From address to be used in the client.&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Ref: &lt;A href="https://www.servicenow.com/docs/bundle/xanadu-platform-administration/page/administer/notification/task/t_CreateAnEmailClientTemplate.html#:~:text=On%20the-,Sender%20Configuration,-tab%2C%20select%20the" target="_self"&gt;Create an email client template &amp;gt; Sender Configuration&lt;/A&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Timi_0-1731314724694.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/400789i74C6D3A6386C1EBC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Timi_0-1731314724694.png" alt="Timi_0-1731314724694.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Tai Vu&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 08:45:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3101199#M1610</guid>
      <dc:creator>Tai Vu</dc:creator>
      <dc:date>2024-11-11T08:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Set From address dynamically in email client template</title>
      <link>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3101421#M1611</link>
      <description>&lt;P&gt;How to call this email script from email email client template?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 12:16:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3101421#M1611</guid>
      <dc:creator>PrashanthB80186</dc:creator>
      <dc:date>2024-11-11T12:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Set From address dynamically in email client template</title>
      <link>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3102062#M1613</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/809038"&gt;@PrashanthB80186&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can add a&amp;nbsp;${mail_script:&lt;EM&gt;script name&lt;/EM&gt;}&amp;nbsp;embedded script tag to the body of the email notification or template, replacing&amp;nbsp;script name&amp;nbsp;with the name of the script you created. This makes it easy to use the same scripts in multiple email notifications or templates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can add the script everywhere in the mail.&lt;/P&gt;&lt;P&gt;Since this is regarding the from, I would add it on the top-line, so you quickly see if the script is used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More information can be found here:&amp;nbsp;&lt;A href="https://www.servicenow.com/docs/bundle/xanadu-platform-administration/page/script/server-scripting/concept/c_ScriptingForEmailNotifications.html" target="_blank" rel="noopener"&gt;https://www.servicenow.com/docs/bundle/xanadu-platform-administration/page/script/server-scripting/concept/c_ScriptingForEmailNotifications.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example can be found in the ootb mails, like the "Admin Center Content Shared" email.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HayoLubbers_3-1731396371812.png" style="width: 999px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/401036iD56DD3708D69B7EF/image-size/large?v=v2&amp;amp;px=999" role="button" title="HayoLubbers_3-1731396371812.png" alt="HayoLubbers_3-1731396371812.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mail script with email.setFrom:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HayoLubbers_2-1731396303283.png" style="width: 999px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/401034iEA96FD4B23EFC48A/image-size/large?v=v2&amp;amp;px=999" role="button" title="HayoLubbers_2-1731396303283.png" alt="HayoLubbers_2-1731396303283.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hayo&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 07:26:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/set-from-address-dynamically-in-email-client-template/m-p/3102062#M1613</guid>
      <dc:creator>Hayo Lubbers</dc:creator>
      <dc:date>2024-11-12T07:26:40Z</dc:date>
    </item>
  </channel>
</rss>

