How to target a field with a lufez

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

I’m looking to highlight a field in the admin panel from an error in a lifecycle event. The docs just have foo: bar I’ve tried adding fields names for foo, and guessing bar is the actual error message.


export default {
    async beforeUpdate(event) {
        const example = await strapi
        .query("api::example.example")
        .findOne({ id: event.params.where.id });
        const exampleUpdated = { ...example, ...event.params.data };

        if (exampleUpdated.category == null) {
        // throw new ApplicationError("Something went wrong category", {
        throw new ValidationError("Something went wrong category", {
            for: "bar", // from strapi docs
        });
        }
    },
};```

Hmmm, I havn’t noticed errors been highlighted in Strapi Admin, but if it did I think you can get a hint from checking the network tab of developer tools to see the payload when making the request that returns the error.