i wrote validatefield() method in table methods in ax 2012.but when cursor leaves the field it is not firing.even i put the break point in validate field method to check any error,but the method itself not firing.i have used this method many times in ax 2009 but i never got any issue.
you can check by doing next CIL also sometimes it also works as doing full CIL takes about 5 hrs which it took in my case first go for next CIL it hardly takes few minutes… if it is not working go for full CIL
validateField() is executed when leaving a form field. It runs on client, therefore it can’t run in CIL.
Can you provide more details about your particular case? validateField() normally works without issues, so you probably do something wrong (but we can’t say yet what it is).
my scenario is to check the marks entered for student for telugu subject should be between 0 to 100 and my code is
public boolean validateField(FieldId _fieldIdToCheck)
{
boolean ret;
ret = super(_fieldIdToCheck);
switch(_fieldIdToCheck)
{
case fieldNum(StudentsMarksDetails,Telugu):
if(this.Telugu <= 100 && this.Telugu >= 0)
{
ret = true;
}
else
{
ret = checkFailed(“please enter the value between 0 & 100”);
}
break;
}
return ret;
}
same code is working in 2009 but in 2012 it is not working(validatefield() itself is not firing). what is the reason? any property to be set?
Use an infolog instead of a breakpoint to ensure yourself that your problem isn’t related to debugger. Test validateField() in standard tables (e.g. PurchLine) to see that validateField() works. Check what you do differently.
Tell us more about your form. Ensure yourself that you don’t have validate() without super() on the data source field.
If it doesn’t help, please prepare a trivial example (without any unrelated code) and give us the .xpo.
i tried the same code in other instance and it worked successfully(validatefield() fired) but in my instance it is not working,even i tried the base validatefield() in vendTable it is also not working.
If you suspect your environment isn’t initialized properly, you can try to compile the AOT and generate full CIL. Also ensure yourself that all components have the same version.
If you’re really sure that the problem isn’t in the way how you detect whether a method is called and that the standard code doesn’t work, reinstall the environment.
An update one this. We were able to find the source of this problem.
Apparently, we applied a kernel hotfix on the AOS machine but didn’t apply that to the AX clients on the end user machines.
Therefore, a different kernel version would be displayed in the About form on the end users’ AX client and a different version in the About form on the AOS’ AX client.
Installing the hotfix on each AX client resolved the problem.
Unfortunately, it was not obvious at all what was the source of this problem and caused us days of investigation.
It would be great if the application would somehow indicate that there is a version difference and give an error/warning message (or write to the log).
Hope this is of helps to others out there who might be struggling with a similar issue.
Such a warning already exists - it’s logged in the event log. You should look for “Dynamics AX Client and AOS Version mismatch”, if I remember it correctly.