Skip to content

Instantly share code, notes, and snippets.

@icerge
Created January 2, 2019 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icerge/c9c5b65ad22515cfede4b28ac6d0e5a4 to your computer and use it in GitHub Desktop.
Save icerge/c9c5b65ad22515cfede4b28ac6d0e5a4 to your computer and use it in GitHub Desktop.
Enrich Send/Receive Email posts of Activity log

Use case

I'd like to reply to an email recieved in a ticket... right from the activity log.

Sample idea - Render reply/reply all buttons

Add UI controls to Activity formatter

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);
}

Manipulate Email Client templates

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.

Sample #2 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment