I'd like to reply to an email recieved in a ticket... right from the activity log.
It's actually a processor - EmailDisplay. Locate function writeBody and construct output HTML sample before it is printed.
//g_processor.writeOutput(TEXT_HTML,TOP_HTML + SecurityUtil.escapeScript(emailRecord.body))
var t = TOP_HTML;
t += '<div style="padding-top:0em; padding-bottom:2em">';
t += '<input class="btn btn-default" type="button" value="Reply" onclick="replyEmail(\'' + g_request.getParameter("email_id") + '\')"/>';
t += ' ';
t += '<input class="btn btn-default" type="button" value="Reply All" onclick="replyAllEmail(\'' + g_request.getParameter("email_id") + '\')"/>';
t += '</div>';
t += SecurityUtil.escapeScript(emailRecord.body);
g_processor.writeOutput(TEXT_HTML, t);
It's not all, but the rest is not easy to understand and live with. rtype is a key for template selection in the next section.
function replyEmail(email) {
var addOn = null;
var table = parent.g_form.getTableName();
var rtype = "reply";
parent.emailClientOpenPop(table, false, rtype, email, addOn);
}
function replyAllEmail(email) {
var addOn = null;
var table = parent.g_form.getTableName();
var rtype = "replyall";
parent.emailClientOpenPop(table, false, rtype, email, addOn);
}
Locate Client Templates related to Email [sys_email] table. They are used by email client. They are select depending on rtype. The content of initial email user replies to can be loaded to email client using such a template and a mail script.