- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2025 09:47 PM
Hi Team,
I have a quick question. I’m trying to configure the Compose Email action in Workspace so that the To, CC, Subject, and Body fields are pre-populated by default.
This is the UI Action - Compose email
function onClick(g_form) {
var LEGACY_EMAIL_CLIENT_NAME = 'sn-email-editor',
SEISMIC_EMAIL_CLIENT_NAME = 'sn-email-client-wrapper',
EMAIL = 'sys_email',
DRAFT = 'sys_email_draft',
tValue = DRAFT;
//get the list of renderers
var renderers = [];
if (ux_globals && ux_globals.presource['sn-workspace-content:snCustomRenderer']) {
renderers = ux_globals.presource['sn-workspace-content:snCustomRenderer'].data.GlideRecord_Query.sys_aw_renderer._results;
}
if (renderers.length > 0) {
// Filter out Email renderers
var renderMap = {};
renderers.filter(function(o) {
return o.table.value == EMAIL || o.table.value == DRAFT;
}).map(function(o) {
renderMap[o.table.value] = o.custom_renderer_tag.value;
});
//Figure out the final value
if (!renderMap.hasOwnProperty(DRAFT))
tValue = EMAIL;
else {
if (!renderMap.hasOwnProperty(EMAIL))
tValue = DRAFT;
else if (renderMap[EMAIL] == LEGACY_EMAIL_CLIENT_NAME)
tValue = EMAIL;
}
}
var dirtyFieldList = g_form.serialize(true).map(function(field) {
return {
field: field.name,
value: field.value
};
});
g_aw.openRecord(tValue, '-1', {parentTable: g_form.getTableName(), parentSysId: g_form.getSysId(), headerValue: getMessage("New Email"), dirtyFields: dirtyFieldList});
}
Could you please advise on the best way to achieve this?
Thank you for your support.
Best regards,
Prajwal
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2025 09:58 PM
you should not touch the OOTB UI action
Instead you should configure the email client template for your table and there you can mention TO, CC, BCC, Subject, Body etc
Once configured and you click "Compose Email" in workspace the template gets applied and fields will be populated accordingly
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2025 09:58 PM
you should not touch the OOTB UI action
Instead you should configure the email client template for your table and there you can mention TO, CC, BCC, Subject, Body etc
Once configured and you click "Compose Email" in workspace the template gets applied and fields will be populated accordingly
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2025 05:01 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2025 07:35 AM
Hi @Ankur Bawiskar,
Thank you very much for your response 😄. It worked as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hi!
I have a related list of users. I want to check those that I want to send an email to, and then click on a "Compose Email" declarative action that opens the email draft and automatically populates the recipients based on the users I selected on the related list. How do I do that?
