Data is not seen in the lifecycle hooks for the component inside a collection

Yes seems pretty daft you can’t access the data easily, but after much digging I found this option to access the data

  async beforeUpdate(event) {
    const { data, where, select, populate } = event.params;
    const ctx = strapi.requestContext.get();
    console.log(ctx.request.body);
  }

Although not sure how much it helps as there no obvious way to alter the data before saving it

3 Likes