Email Client Template

BRUNO BANDEIRA
Tera Guru

Hello guys,

Could you help me with this problem!

I have the need to filter witch itens are gonna to appear in the 'TO' and 'CC' form in the compose email modal (That one that appears when you select 'Email' in the three dot button.

 

I have configured everything nicelly, and select the TAB Sender Configuration and select the SCRIPT option, using the snippet bellow:

 

(function(fromAddressQuery, targetRecord) {
    /**
     * fromAddressQuery: A GlideRecord on the table "sys_email_client_from_address".
     * targetRecord: A GlideRecord representing the record in which the Email Client was opened.
     */

    var recipients = {
        to: 'to_email@example.com',
        cc: 'cc_email@example.com'
    };

    // Log the values for debugging
    gs.info('To Field: ' + recipients.to);
    gs.info('CC Field: ' + recipients.cc);

    return recipients;
})(fromAddressQuery, targetRecord);
 
The log is showing that the execution of the script is running smoothly, but, nothing appears on both fields when the modal is open, TO and CC are empty.
 
What am I doing wrong?
2 ACCEPTED SOLUTIONS

Ahmmed Ali
Mega Sage

Hello @BRUNO BANDEIRA 

 

The script you have configured is for showing the from address for the email. If you want to configure the TO, CC and BCC dynamically, you will need to create a script include and call that script include in the respective field in recipient tab (the script function should return string of comma separated email IDs.

 

AhmmedAli_0-1735829278039.png

https://www.servicenow.com/docs/bundle/xanadu-platform-administration/page/administer/notification/t... 

 

Thank you,

Ali

 

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

View solution in original post

BRUNO BANDEIRA
Tera Guru

Thanks for your support @Ahmmed Ali and @Ankur Bawiskar this approach of javascript prefix did work for me!

View solution in original post

6 REPLIES 6

Hello @Yaraslau 

Yes customization could work, we wanted to avoid it.
glide.ui.email_client.allow_invalid_email_address_as_recipient_after_user_resolution this property did the work in our case.

Hope it will helps others.

Thanks

BRUNO BANDEIRA
Tera Guru

Thanks for your support @Ahmmed Ali and @Ankur Bawiskar this approach of javascript prefix did work for me!