I tried the same for Strapi v4, but it does not work. Is this still supposed to work the same way?
const slug = await strapi.config.functions['utils'].slugify(data.name);
error: Cannot read properties of undefined (reading 'utils')
TypeError: Cannot read properties of undefined (reading 'utils')
at Object.afterUpdate ((...)\src\api\cookbook\content-types\cookbook\lifecycles.js:13:51)
at modelsLifecyclesSubscriber ((...)\node_modules\@strapi\database\lib\lifecycles\subscribers\models-lifecycles.js:15:41)
at Object.run ((...)\node_modules\@strapi\database\lib\lifecycles\index.js:47:17)
at Object.update ((...)\node_modules\@strapi\database\lib\entity-manager.js:260:27)
at async Object.update ((...)\node_modules\@strapi\strapi\lib\services\entity-service\index.js:219:18)
at async Object.<anonymous> ((...)\node_modules\@strapi\strapi\lib\services\entity-service\index.js:67:20)
at async Object.update ((...)\node_modules\@strapi\plugin-content-manager\server\controllers\collection-types.js:123:27)
at async returnBodyMiddleware ((...)\node_modules\@strapi\strapi\lib\services\server\compose-endpoint.js:52:18)
at async module.exports ((...)\node_modules\@strapi\plugin-content-manager\server\middlewares\routing.js:39:3)
at async policiesMiddleware ((...)\node_modules\@strapi\strapi\lib\services\server\policy.js:24:5) at async (...)\node_modules\@strapi\strapi\lib\middlewares\body.js:24:7
at async (...)\node_modules\@strapi\strapi\lib\middlewares\logger.js:22:5
at async (...)\node_modules\@strapi\strapi\lib\middlewares\powered-by.js:16:5
at async cors ((...)\node_modules\@koa\cors\index.js:95:16)
at async (...)\node_modules\@strapi\strapi\lib\middlewares\errors.js:13:7
at async (...)\node_modules\@strapi\strapi\lib\services\metrics\middleware.js:29:5