- 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
Thursday
I have an similar use case where from sc_task table - I have this email client template, where the Subject is "request_item.number, request_item.cat_item.name" as shown in the image.
When I try to compose email from SOW - the subject line is not working as expected. Is it because of dot walking or anything else. Happy to work on your responses. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
@Ankur Bawiskar Please check my above query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
could you raise a separate question for this and tag me there and share all the details as this is an old thread
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader