Validatefield() method is not firing in ax 2012?

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.

please give me the solution

Hi Srikanth,

Please Generate Full CIL and check.

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

Sorry it is not next CIL it is generate incremental 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?

Showing a content of a method that is not called can’t tell us anything about why it’s not called.

By the way, you have a bug in your code. If Telugu is between 0 and 100, your method returns true even if the system validation (in super()) failed.

hi martin,

what else details i shoud send so that the issue can be solved.

i try to check it by keeping break point but the method itself is not firing…

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.

hi martin,

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.

Have you verified that the problem isn’t related to the debugger?

ya,no problem with debugger,its working fine.

is there anything do with increment cil?

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.

I think Application & kernel versions are different…please check that…

Good afternoon

We are facing a similar situation which is very odd.

The table validateField() method is not being called when leaving a field and that goes for all tables within AX 2012.

The weirdest part is that if you are using the client running on the server everything works perfectly fine!

The validation is skipped only when the client is running on the user’s PC.

This happens to all users. The OS running on users’ PCs is Windows 7 and Windows 8.

I’ve tried compilation, full CIL generation but no luck.

I tried debugging this to see where it fails. The validate() method of the DS field get called but it doesn’t seem to execute the super() call.

Could this be related to the operating system and it requires a hotfix?

I’ve searched for days on this topic and also went through the released hotfixes list but haven’t found anything sounding related to this.

For your info, we are running have an AX 2012 R2 installation, AOS and DB on the same machine.

OS is Windows Server 2012 R2 and DB is SQL Server 2008.

Any ideas are greatly appreciated!

Thanks.

Good afternoon everyone

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.

Thanks.

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.

Hi Martin

You are right. I just found an entry in the event log of the AOS stating “Object Server 01: Internal version mismatch.”