Hi @piwi
What would be the equivalent solution in Strapi v4.0 of the elegant code snippet that @christianguevara has proposed (cf. below) ?
Thanks & Regards,
module.exports = {
lifecycles: {
beforeCreate(data) {
if (someCondition(data)) {
// throw error here, it will prevent the entry creation
throw strapi.errors.badRequest('Some message you want to show in the admin UI');
}
},
},