How can I overwrite the system fields on a Transform Map ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2019 06:07 AM
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
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2019 12:53 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2019 12:55 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2019 01:01 PM
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.