(function() {
var url = decodeURIComponent(window.location.href);
var match = url.match(/sys_id[=%3D]+([a-f0-9]{32})/i);
if (!match) {
alert('Could not extract sys_id. Are you on a record with a sys_id in the URL?');
return;
}
var sysid = match[1];
// Detect table from the URL
var table = 'incident';
if (url.includes('sc_req_item') || url.includes('RITM')) {
table = 'sc_req_item';
} else if (url.includes('sc_task') || url.includes('SCTASK')) {
table = 'sc_task';
} else if (url.includes('change_request') || url.includes('CHG')) {
table = 'change_request';
}
var emailUrl = '/email_client.do?sysparm_table=' + table +
'&sysparm_sys_id=' + sysid +
'&sysparm_target=' + table +
'&sys_target=' + table +
'&sys_uniqueValue=' + sysid +
'&sys_row=0&sysparm_encoded_record=&sysparm_domain_restore=false&sysparm_stack=no';
window.open(emailUrl, '_blank', 'width=900,height=700');
})();
Open Email Client
Hint: Open the email client for the current record
Trigger: \email