Hello fellow Espo-ers!
I would like to know what the best practice would be to include a calculated field when fetching an Entity.
For example, say I have an Entity called `User` and there is a field called `taskCount` which represents the number of currently active Tasks assigned to them. This field could be of type `Integer` and in the `entityDefs` for the field, it would be marked as `notStorable`.
However, if I want to populate this field every time a `User` entity is fetched, where is the best place for this work to be done? Would it be in the Repository for the Entity or would it be more suited to live in the Service - given that it pulls data from another Entity?
I would also like to be able to sort by this calculated field too.
Thanks in advance!
I would like to know what the best practice would be to include a calculated field when fetching an Entity.
For example, say I have an Entity called `User` and there is a field called `taskCount` which represents the number of currently active Tasks assigned to them. This field could be of type `Integer` and in the `entityDefs` for the field, it would be marked as `notStorable`.
However, if I want to populate this field every time a `User` entity is fetched, where is the best place for this work to be done? Would it be in the Repository for the Entity or would it be more suited to live in the Service - given that it pulls data from another Entity?
I would also like to be able to sort by this calculated field too.
Thanks in advance!
Comment