Skip to content →

MS Dyanmics AX Development Posts

Understanding modifedField() Table method in DAX 2012

Hi everyone,

We use modifiedField() method to perform any actions after the field is modifed

Create new table with 2 fields ItemId and ItemNameDisplay from Extended Data Types node in AOT then Override modifiedField() in Table’s method node, something likes:


the modifiedField() method is located on tables and it is called by a form (or a dataset) when any field is changed. It has field ID as a parameter and therefore it is very easy to write code reacting to a change of a particular field. It is so easy that the modifiedField() method is often used even in such cases, when it really shouldn’t be used.
If you want to get previous field value in the modifiedField() for comparative purpose, you can use this.orig() method:


Leave a Comment

Keys are in Dynamics AX – simple summary

  • There is a maximum of one Primary Key per table, whereas a table can have several alternate keys. The primary key is usually the type of key that other tables, called child tables, refer to when a foreign key field in those other tables need a relational identifier.
  • For new tables the default is a primary key based on the RecId field , incremented number or a completely meaningless number that is generated by the system surrogate key.
  • Alternate key can be chosen as the Replacement Key of a table that can display on forms instead of a meaningless numeric primary key value. Each table can have a maximum of one replacement key.
  • Natural key has meaning to people. Most replacement keys are natural keys.
  • Relations represents a foreign key.

Leave a Comment

Using Methods in Table Filters & Query Ranges in Dynamics AX 2012

In Dynamics AX, there is a class called SysQueryRangeUtil that can be utilized in both query ranges and table filters. Using methods from this class allow you to be very precise about what dates you want to use in reports or for filtering your data.

Let’s say you have a report that you always want to run to see orders with shipping dates of the next day. It is possible to do so by using one of the methods from the SysQueryRangeUtil. The use of the letter ‘t’ will work for today’s date, but when you try to add days to it, it doesn’t work in reports. Instead, I will use the currentdate() method and add 1 to it.
Note: All methods & expressions must be surrounded by parentheses as shown below.


Figure 1 – Filtering the requested ship dates in an AX query for tomorrow (current day + 1)

On any form with a grid, you filter your data by pressing Ctrl+G. If I were to want to see open customer invoices from the last 90 days, I would filter my open customer invoices form and use the method(dayRange(-90,0)). The first number represents how many months backward from this month, and the second represents how many months forward. The same sorts of things can be done for themonthRange(), yearRange(), and dateRange() methods. The best part about this is that you can of course save these filters to create views that you might use on a daily basis.


Figure 2 – Searching the grid for the past 90 days

If you are creating your query ranges in code, these methods can also be utilized whenever you are setting them. Definitely be sure to check out the SysQueryRangeUtil class as there are many more methods to use.

Here are some of them:


  • (dayRange(-30,0)) – Results in a date range for the last 30 days: “26-01-2014”..”25-02-2014″
  • (day(-1)) – Results in yesterday’s date: 24-02-2014
  • (day(0)) – Results in today’s date: 25-02-2014
  • (day(1)) – Results in tomorrow’s date: 26-02-2014
  • (greaterThanDate(2)) – Results in every date after today plus 2: > 27-02-2014
  • (lessThanDate(-1)) – Results in every date of today minus 1: < 24-02-2014
  • (monthRange(0,2)) – Results in first day till the last day of the month’s choosen (0 = current month): “01-02-2014”..”30-04-2014″
  • (yearRange(-1,-1)) – Results in first day till the last day of the chosen year: “01-01-2013”..”31-12-2013″
Leave a Comment

Recalculate InventSum

InventSum is needed to recalculate sometimes.We should use InventSumRecalcItem class in Dynamics AX.

First parameter : ItemId
Second parameter : Show errors
Third parameter : Fix or only check

If you want to calculate for all items :

Source: Dynamics AX Blog of Anil: Recalculate InventSum

Leave a Comment



Those kind of errors will come when you move report from Dev Server to Live Server, even compilation in DP Class, Query, Contract, table … without any error

AX1004: Reference System.Core, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089 was not a valid model assembly.


MSB3644: The reference assemblies for framework “.NETFramework,Version=v4.0” were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK 

Version: Dynamics 2012 R3 Cu9, SQL Server 2014, Windows Server 2012 R2


There is no reference Assemblies Version 4.0  under C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework on Windows Server 2012 R2 (only Version 4.5 it have)


Copy those Assemblies from your laptop (Windows 7,8,10) to Server

Compile project.


Happy AX


Leave a Comment

SSRS (SQL Server Reporting Services) – Expressions or Functions used in SSRS

Expressions or Functions used in SSRS

Expressions are usually used for appearance of the data in a report, change properties of the fields, calculate some values and display them in a proper way, compares values between data of fields and then display them.

Types of Expressions

Operators – Arithmetic, Comparison, Logical
Common Functions – Text, Date & Time, Math, Inspection, Program Flow, Aggregate, Financial, Conversion, Miscellaneous

We can see each and every one very deataily


Global expressions executes/works in Page Header and Footer parts only.

ExecutionTime shows date and time at when report executes

PageNumber shows page number of each and every page but allowed only in page header and footer

ReportName displays name of the active report what name we have assigned to the active report

UserId shows current user name like company/userID

Language displays language like US-English…



^ power of
* multiplication
/ divides two numbers and returns a floating point result
\ divides two numbers and returns a integer result
Mod divides two numbers and returns remainder only
+ adds two numbers and concatenation for two strings
subtraction and indicates negative value for numeric values


Known operators : < <= > >= <>

Like compares two strings and return true if matched or else returns False. Ex: =Fields!Title.Value Like Fields!LoginID.Value

Is compare two object reference variables Ex: = Fields!Title.Value Is Null


+ and & symbols uses for concatenation


Known: And, Not, Or

Xor SELECT * FROM users where firstname = ‘Larry’ XOR lastname = ‘Smith’

AndAlso First condition will check first and if it is true only, goes to next or else it won’t need to check. Because our execution time is saving in a logical operation in which more conditions is combined using AndAlso function.

OrElse same like above

Continue reading SSRS (SQL Server Reporting Services) – Expressions or Functions used in SSRS


Create record in DimensionAttributeValueCombination table manually.

Hi all,

Today, i will post the way to create a record into DimansionAttributeValueCombination in code and get RecID of this.



Result :


You can use this recId for Ledger Dimension field in LedgerJournalLines table or wherever you want.

Thanks for reading :).

Leave a Comment

SSRS Report Server Settings Validation Error- AX 2012 R3 CU9

Recently I updated my dynamics Ax development Environment by restoring Database from Production Dynamics AX DB and I got this problem “Make sure that SQL Server Reporting Services is configured correctly. Verify the Web Service URL and Report Manager URL configuration in the SQL Reporting Services Configuration Manager.

Anyway, The reporting Services are still working fine and i have already granted the AX Admin as System Administrator under site settings, Home folder settings and DynamicsAX folder with “Browser, Content Manager, DynamicsAXBrowser, My Reports, Publisher, Report Builder” roles.

Solution is we need disable UAC (I’m using Windows Server 2012 R2) by Regedit

go to Regedit: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system” and changing the DWORD “EnableLUA” from 1 to 0.

After the reboot, UAC is disabled.



Leave a Comment

Reporting service: “Only integrated security is supported for AX queries”

I updated my dynamics Ax development Environment by restoring Database from Production Dynamics AX Db. After the restoring the database, when I run any report form Dynamics Ax, all gave error  “Only integrated security is supported for AX queries.”

The reporting Services are still working fine.

For this, best way to redeploy them, create a new report folder, open Microsoft Dynamics Ax 2012 Management Shell (make sure you run Powershell as Administrator).

Publish-AXReport -ReportName *


Leave a Comment