Please guide me iam getting below error in ax 2012...
How can I resolve this error
In AX 2012, you can't declare variables inside 'case' block. You need to declare the variable on the top of the method.
Declare the variable at top of the method..again same error showing.
Please give us your code as text, so we can see it in full and compile it ourselves.
Use Insert > Code (in the rich formatting view) to paste it here.
Iam unable to paste the code here..
Don't use today as a variable name
Public boolean Validate field(FieldId _fieldIdToCheck)
{
Timezone clientTimeZone;
TransDate today;(Getting error in this line : variable TransDate has not been declared)
boolean IsValid;
Is valid = super(_fieldIdToCheck);
switch (_fieldIdToCheck)
case FieldNum(FMS_ResortTable, Acquisition Date):
clientTimeZone = DateTimeUtil::getClientMachineTimeZone();
today = DateTimeUtil::getSystemDate(clientTimeZone);
if(this.AcquisitionDate < today)
IsValid = CheckFailed ("FMS23");
}
break;
return IsValid;
As others already pointed out, you can't use "today" as a variable name.
I have changed the variable name and the error now showing in the below line
getSystemDate(clientTimezone);error I am getting:GetSystemDate Is not a class method
Well, there's not a method called DateTimeUtil::getSystemDate, so you will get an error.
If you type DateTimeUtil:: the IntelliSense shows you what's available.
If you need the current date, you can use systemDateGet() function.
Generally I'd like to suggest that you participate in some development basics course, so that you'll learn to the basics of the x++ syntax, IntelliSense and other things.
Thanks..
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,004
André Arnaud de Cal... 857 Super User 2025 Season 2
Sohaib Cheema 548 User Group Leader