Skip to main content

Posts

Enum values in Query ranges

I've come accross a very geniun mistake which most of the developers usually do. Specially those who are working on a single language and do not test their code properly for other languages. This is related to the use of Enum values in Query ranges. public void init() { QueryBuildRange criteriaOpen; ; super(); criteriaOpen = this.query().dataSourceTable(tableNum(ProdTable)).addRange(fieldnum(ProdTable, ProdStatus)); criteriaOpen.value("Started"); // it does not work in non-English interface!!! Though you will not find any compilation or run time error with this. However, the query will not read value when you run it in non english environment. The correct way to use enum in query is criteriaOpen.value(QueryValue(ProdStatus::StartedUp); }

How to Restrict Multiple Time login of a same user

Hi Friends, Many times intentionally or unintentionally a user may open multiple session of AX. That surly impact your performance. So here is a fix, 1.       Go to AOT 2.       Open class ‘Info’ 3.       Copy Paste the Following Code in startupPost method. void  startupPost  () { // To restrict user login form second login xSession session; SysClientSessions SysClientSessions; UserId currentUserId; int counter; ; currentUserId = curUserId(); if(currentUserId!="Admin")// only Admin User is allowed to login multiple time { while select SysClientSessions where SysClientSessions.userId == currentUserId && SysClientSessions.Status == 1 // 1 : Login 0 : Logout { session = new xSession(SysClientSessions.SessionId, true); if (session && session.userId()) { counter++; } } if(counter>=2) { Box::stop("Already Logged-in : The same user...

AX 2012 R2 Step By Step Installation

AX 2012 R2 Step By Step Installation  As you know the much awaited AX 2012 R2 is launched. I just installed AX on my local computer, So i am just sharing some screen shots for your reference to install AX 2012. 1) Start the Setup Program.    2) Click "Microsoft Dynamics AX Components" under Install.    3) Click Next.    4) Select "I accept the license terms" *.    5) Choose Appropriate Option.    6) Processing will start.      7) Choose "Add or modify components".    8) Select Options to install/upgrade.    9) Review the Errors/warnings and click on "Configure" check box for the  applicable errors. and click "Configure".   10) Click "Start" to start configuring components as per AX needs.   11) Select "Configure existing database (for upgrade scenarios)".    12) Specify your existing databases.    13) Choose models to upgrade.    14) Specify the "Temp...

Pass values between form and report

How to pass values between form and report Here is for example the code of the button that calls the report: void clicked () {     Args     args;     ReportRun          reportRun;     ;     super();     args = new Args();     args.name(Reportstr(HistoryHolidays));     args.parm( LogId  );     reportRun = classfactory.reportRunClass(args);     reportRun.init();     reportRun.run();     reportRun.wait();     args.parmObject( args ); } in the init method of your report try this: public void init() {     if( element.args() )     {         logId =  element.args().parm();     }      super(); } then you can use this parameter i...

View Control

Hi Friends,  Here is step by step Tutorial for ListView FormControl.  During this tutorial we create a separate Form (just for testing this tutorial).  ListView Control helps you when you want to select multiple records from a list of records see below image    Follow this steps  Step 1:  Create a new Form and name it “_ListView”  In design Node, Add a new Control called ListView and name it as “LeftListView” as shown below.    By default -AutoDeclaration property of the ListView will be “Yes”.(Because you have to access this in your code for insert/Access/Delete items from ListView)  Now lets learn some important properties of the listView. Change the View type property from “Icon” to “Report” s shown below.    Save the form and now let’s add coulmns to the list view. Since we have set the autodeclaration property of the LeftListView to “yes”, we can use this control inside the code. Step 2:  Override the init() met...