Example of code to Validate field in axapta using validate method of datasource
public boolean validateField(fieldId _fieldIdToCheck)
{
boolean ret;
ret = super(_fieldIdToCheck);
if (ret)
{
switch (_fieldIdToCheck)
{
case fieldnum(MyTable, custName) :
if (strlen(this.custName) <= 3)
ret = checkFailed("Customer name must be longer than 3 characters.");
}
}
return ret;
}