Posts

Showing posts from July, 2024

Different types of query range value assignment (Expressions and conditions as range value) X++ D365FO

 In the example below, we construct a query and add a single datasource. The range is then added, using the DataAreaId field on each table. Any field can be used, but using an unusual one such as DataAreaId helps remind a casual reader of the code that it’s not a normal range. query = new Query(); dsInventTable = query.addDataSource(tableNum(InventTable));   // Add our range queryBuildRange = dsInventTable.addRange(fieldNum(InventTable, DataAreaId)); Given the above, the following are valid range specifications: Simple criteria[edit] Find the record where ItemId is B-R14. Take note of the single quotes and parenthesis surrounding the entire expression. queryBuildRange.value(strFmt('(ItemId == "%1")', queryValue("B-R14"))); Find records where the ItemType is Service. Note the use of any2int(). queryBuildRange.value(strFmt('(ItemType == %1)', any2int(ItemType::Service))); Find records where the ItemType is Service or the ItemId is B-R14. Note the nesti

JSON and XML messages deserialization in D365 Finance and Operations

Image
  In this article, I will explain concepts of JSON and XML message deserialization into X++ class contracts for D365 Finance and Operations (FO). And of course, the implementation of it. A short introduction to the topic As these days cloud ERP system like D365 FO, provides much more functionality than “old” Axapta, in a complex world of distributed services. It is more dependent on communication with external systems than ever. However, the tooling that is provided and the legacy of X++, puts a lot of grief in complex Integration with the outside world. Since AX7 has been put into the Azure cloud, the exchange of text files (of various structures) became a nuisance. As we move towards a growing number of API integrations, it puts more pressure on using open standards like JSON and XML. As I would like to abstract from how the message with XML/JSON information comes into the system, there are many ways of doing this. I will cover only topics dealing with the text content of such a mess