As part of our use of Strapi for managing entities, we have identified a need related to the duplication of an entity.
Currently, when an entity is duplicated, no specific event or lifecycle hook appears to be triggered for this action, which limits our ability to apply custom business logic.
We would like to:
Investigate whether there is a dedicated hook or event triggered during entity duplication.
If not, explore the possibility of adding a custom solution to execute specific logic when an entity is duplicated.
Search about lifecycle.js.
So you can catch the event of duplication like this;
src/api/article/content-types/article/lifecycles.js
export default {
async beforeCreate(event) {
const { data } = event.params;
const existing = await strapi.entityService.findMany('api::article.article', {
filters: {
title: data.title,
},
});
if (existing.length > 0) {
throw new Error('already exists!');
}
//
// strapi.log.warn(`Duplicate entry detected for title: ${data.title}`);
},
};
i strongly suggest to use AI tool in the page of strapi doc.
Also you can create a plugin for more flexible solution but i belive lifecycle hooks may solve your issue.
Love Strapi 