Duplicate entry not triggering lifecycle

System Information
  • Strapi Version: 4.3.4
  • Node Version: 14

Hello my lifecycles hooks methods (beforeCreate, afterCreate) are not triggered when duplicating an entry. The do work when creating a new entry.

Is this the normal behaviour?


I think the reason for this is that it would be UPDATE not create when duplicating.

I see, but when duplicating the idea is to create a new one based on the duplicated one. Should not trigger CREATE logic ?

Try do a test with beforeUpdate or afterUpdate and see if it triggers :slightly_smiling_face:

I’m seeing the same issue. When I duplicate an entry via the ‘duplicate entry’ button in the list view, it opens the new clone of the data. When I click save, the expected ‘beforeCreate’ lifecycle hook is not fired. (I also confirmed that beforeUpdate isn’t fired, but wouldn’t expect that one to fire anyway since it’s a create call.)

The issue in my case is that I have a read-only, auto-generated UUID which obviously shouldn’t be duplicated, but I can’t set a new one in the beforeCreate hook since it’s not being fired… or perhaps the validation happens before running the lifecycle hook, which would be surprising.

Any thoughts/hints/tips/solutions appreciated.