How can I overwrite the system fields on a Transform Map ?

Felipe Santos4
Mega Contributor

I am trying to import records from one instance to another, so the approach I chose is to create a Data Source that will bring all the records I want via XML (with a specific query), then I set a Transform Map to get the values in the right place.

I get most of the fields right, but some of the system fields insist on being overwritten.
E.g.: sys_updated_on, sys_updated_by, sys_created_on, sys_created_by get filled with the current time and my user (as I performed the transform), but fields like opened_at and opened_by get the right values (the ones imported).

I've tried using record, field and onBefore transform scripts to manually set those fields:

target.sys_updated_by = source.u_sys_updated_by;

//Never forgetting the following
target.autoSysFields(false);
target.setWorkflow(false);

Also, I've unchecked the field Run business rules in the Transform Map, and still I can't seem to make this work. Those system fields are always overwritten.

Am I missing something here? Is there any other way to do this better? Maybe importing an XML programmatically?

Cheers,
Felipe

3 REPLIES 3

mike_allgire
Giga Guru

If you add a value to the system fields, and save the record; this automatically updates the system fields again to the current date/time or user. You can't do what you are attempting to do.

Well, at least update fields won't work. If you are creating a new record, then the created field can only be updated after it has been inserted.

Mike Allen
Mega Sage

The only way I have been able to set system fields is through XML import.  I have never been able to do it on a create of a record, either through script or import.