📤 Built a useful command? Submit it here — we'll review & add it to the library.

Open Email Client (New Tab)

Hint: Open the email client maximized in a new tab

Trigger: \emailnt

(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];

  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';

  var win = window.open('', '_blank');
  if (win) {
    win.moveTo(0, 0);
    win.resizeTo(window.screen.availWidth, window.screen.availHeight);
    win.location = emailUrl;
    win.focus();
  }
})();