whatnowmax / mailto_email_link

// ==UserScript==
// @name mailto_email_link
// @description creates a mailto link to populate a new email
// @version 1.4
// @author whatnowmax
// @license MIT
// @match https://crm.stagrp.com/index.php?action=DetailView&module=Cases&record=*
// @match https://crm.stagrp.com/index.php?module=Cases*

// @run-at document-end
// @grant none
// ==/UserScript==

(function() {
    'use strict';

    var _custEmail = document.getElementById("case_contact_email_c").innerText
    var _caseNum = document.getElementById("case_number").innerText;
    _caseNum = _caseNum.trim();
    var _caseSubject = document.getElementById("name").innerText;

    var _mail = document.createElement("a");
    _mail.href = "mailto:" + _custEmail + "?subject=Tidal%20Case%20%5B%23" + _caseNum + "%5D%20-%20" + _caseSubject + "&cc=case-update@tidalautomation.com" ;
    //_mail.click();
    _mail.innerText = "(send email)";
    document.getElementById("case_contact_email_c").appendChild(_mail);


})();