migration of “created by” date

Viewing 2 reply threads
  • Author
    Posts
  • December 19, 2021 at 6:59 AM #46093

    Andreas .
    Participant

    Hi,

    to avoid possible data loss I imported all my data as text (unfortunately there is doesn’t seem to be an import log).
    Now I converted everything successfully by some scripts.

    I am just not able to update the creation date using the internal corresponding field type.
    Is there a way to keep my original dates ?

    best
    Andreas

    December 20, 2021 at 4:00 PM #46127

    Brendan
    Keymaster

    The record object itself has a dateCreated property. It works a little differently than actual fields. When you add a Date Created field, Tap Forms handles it just a bit different because the value is stored on the record object itself and not inside the list of field values.

    If you have a separate field that has your creation date values, then you could modify your script to copy the date value into the dateCreated property.

    var date_value = record.getFieldValue(field_id);
    record.dateCreated = date_value;

    Then form.saveAllChanges();

    That should work.

    December 21, 2021 at 1:08 PM #46136

    Andreas .
    Participant

    What is wrong that it is not working for me ?
    I get no error but the field is not beeing updated

    > ….
    > if (date_val_created != undefined) {
    > console.log(date_val_created)
    > record.dateCreated = date_val_created
    > }
    > form.saveAllChanges();
    > …

    From log console
    Fri Aug 19 2011 22:19:11 GMT+0200 (CEST)
    Sun Sep 11 2011 12:22:17 GMT+0200 (CEST)
    Mon Aug 15 2011 01:09:49 GMT+0200 (CEST)
    Mon Aug 15 2011 01:09:49 GMT+0200 (CEST)
    Wed Sep 07 2011 23:58:03 GMT+0200 (CEST)
    Wed Sep 07 2011 23:58:03 GMT+0200 (CEST)

Viewing 2 reply threads

You must be logged in to reply to this topic.