How do you copy a GlideRecord from one extended table to another extended table?

Mike Moody
Kilo Guru

Here is my situation: I am trying to copy all the contents of one GlideRecord from a custom table that is extended from task to a different custom table also extended from task. All the fields I'm interested in copying reside on the task table. I'm trying to do this in such a way as to not have to explicitly copy each field in code. The problem I'm encountering is that once I copy the current record to the new GlideRecord, it takes on the target table of the current record.

Business Rule Code example:
var gr = new GlideRecord('u_tfc_snapshot');
gr = current;
gr.insert();

The above doesn't work because even though I instantiate the gr variable against the custom extended table it is overwritten by the table targeted on the current record. There is a getTableName() function which returns the GlideRecord's table name, however I cannot find an equivalent setTableName('u_tfc_snapshot') function that I can use before Inserting the record.

Any Ideas?

Thanks!

Mike

5 REPLIES 5

Thanks!

 

How do you then redirect to the new record? in the UI action?