Trying to move Email (sys_email) entries when a case is transferred

Inactive_Us2053
Giga Contributor

Hi,

  I've been asked to try and move associated emails with a General Case to the transferred case.  I've put a business rule in place which should do this.  It looks like it works when looking at the sys_email table, but doesn't show up in the activity list of the new task.  I have made sure that the sent/received emails is in the activity list for the form and that the user I am viewing the form with has the appropriate role to see sent and received emails.

// OnAfter 'insert' business role on sn_hr_core_case
// Condition 'Transferred from' is not empty

(function executeRule(current, previous /*null when async*/) {

	var email = new GlideRecord('sys_email');
	email.addQuery('instance', current.transferred_from.sys_id);
	email.query();
	while(email.next()) {
		email.instance = current.sys_id;
		email.target_table = current.sys_class_name;
		email.update();
	}

})(current, previous);

Old pre-transferred case, showing email:

Sys_email entry for above:

Transfer case:

No email in Activity list 😞

But the sys_email entry has been updated by the business rule:

6 REPLIES 6

Hi, Could you please share how was your fix and how toggle feature is added. 

Hi Peter ,

Could you please let me know how was your fix , how you have written script for this ?