i want to add a Business Rule in ServiceNow. When i add a new record to the sys_email table with "To"(direct) or "CC"(copied) i want before insert into the table a rule who copy the "to" or "cc" filled fields into the "bcc" filed after the submit and delete the "to" and "cc" entrys. This is my code so far which does not change something. Iam rly new to ServiceNow maybe someone can help me?
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('sys_email');
//gr.newRecord();
gr.addQuery('direct','current.direct');
gr.addQuery('copied','current.copied');
gr.query();
while(gr.next())
{
gr.blind_copied = current.direct +', '+ current.copied;
gr.update();
}
})(current, previous);