Set created_at field on tickets and articles through REST API - again

Hi,

I have exactly the same topic as here: Set created_at field on tickets and articles through REST API
Unfortunately, this question was closed, so I cannot ask there.

For migration purposes I need to set the created_at field of tickets and articles objects. The migration process is done through the Zammad REST API.

I tried to set the field at creation time (POST on /api/v1/tickets and /api/v1/ticket_articles) and using update (PUT on /api/v1/tickets and /api/v1/tickets_articles), but the created_at field stay unchanged.

Thanks!

Infos:

Used Zammad version: 2.3.x
Used Zammad installation source: Official Debian package
Operating system: Ubuntu 16.04 Server
1 Like

Hi @DNF.SaS

per default created_at is only allowed to set via API in import mode. If you have a “productive” Zammad, the created_at (and updated_at) is set by the server.

Because:

  • In a productive environment you do not want to get ticket from the past or from the feature (it’s also SLA related)
  • Technical: It’s used for cache validation

-Martin

You can set Zammad in import mode via:

zammad run rails r 'Setting.set("import_mode", true)'

Note: If Zammad in import mode, almost observer will not run (e. g. agent notifications or sending emails in general). After you have imported you old data, you need to rebuild the search index once:

zammad run rake searchindex:rebuild

1 Like

Hi Martin,

thanks for the fast response - even if it’s not the answer I’d like to hear… :wink:
Background: we have developed an addin for Outlook, which takes an email, looks up the operating-data in zammad (maps the user, looks if already a ticket for the conversation exists or even the mail was already transferred to zammad) and gives it to zammad via the api.
It’s intended for soft-migration of the mail-traffic to zammad.

Regards,
Sascha

soft-migration. Ok. :slight_smile:

It seems that you have a local installation and you are a developer. So I can point you this file zammad/app/models/application_model/can_cleanup_param.rb at develop · zammad/zammad · GitHub - you can change it on your local installation (I’ll remove this comment later to not confuse other regular users)

Understood :slight_smile:
I’m going to set import_mode to true, as it seems not to hurt in any way.
(soft-migration, because I’d like to make every email run over zammad and get rid of outlook some day - it’s not that easy, because of the user-factor…)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.