Validations in Data entities in D365

Hi Everyone,

I have this below requirement in which I need to validate the length of a field value.

Data entity : HCMPositionsEntity

Field : PositionId

No middleware

Source : Excel import (Recurring job)

Current situation : If I write a code in Validate field method (in Data entity), instead of throwing an error it will truncate the value based on the length of the field (Because of the edt).

Need a way to validate the field before it comes to staging table.

Suggestions plz.