Lifecycle hooks relation problem

When I use the lifecycle hook, only connect and disconnect appear in the relation named bank in the data parameter how can i get the data of the bank

I am having the same problem.

If I have something like this:

export default {
    async beforeUpdate(event) {
      console.log(event.params.data.blog_post)
    },
};

In a content type like that:

{
  "kind": "collectionType",
  "collectionName": "abstract_pages",
  "info": {
    "singularName": "abstract-page",
    "pluralName": "abstract-pages",
    "displayName": "Abstract-page",
    "name": "abstract-page",
    "description": ""
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {},
  "attributes": {
    "blog_post": {
      "type": "relation",
      "relation": "oneToOne",
      "target": "api::blog-post.blog-post"
    }
  }
}

I get in the console log this:

{
  disconnect: [
  ],
  connect: [
  ],
}

But in Strapi I can see the relation is there normally.

I am looking for a work around but no luck so far.
Anyone with a possible solution for this?

This issue seems to still exist on the latest Strapi version v4.11.0 as well. Kindly create an issue on strapi git hub if it’s not fixed yet.

After further investigation I found that on update life cycle hooks, it only populates the data of a relation, if the relation data or value is changed/updated. Try putting the below console log to print the value.
console.log(“Item is relation field here>>>>>”, data.item.connect);
It prints as below:
[ { id: 1, position: { end: true } } ]

Hope this helps.

You can check more details on this comment

Thank you very much for you answers!

You are correct @Deepak_Kumar, it is only populating the data that has changed, in the end I settled for the approach @pdhruv93 provided when the relations that did not change are needed.