static void getEnumValues(Args _args) { EnumId enumId = enumNum(LedgerDimensionType); //Put here your enum DictEnum dictEnum = new DictEnum(enumId); int numOfValues = dictEnum.values(); //This method gets the total number of enum values int counter; for(counter = 0; counter < numOfValues; counter ++) { //You can use the number of method exposed by DictEnum class Info(strFmt('%1',dictEnum.index2Value(counter))); Info(strFmt('%1',dictEnum.index2Symbol(counter))); … Continue reading AX / D365FO – How to get values of base enums using code in x++
Author: Marco Saad
AX / D365FO – Disable Auto execute Query on form startup
Do you have a form that takes a long time to open?This is because when it opens, the ExecuteQuery command is immediately executed, which executes the query on the database. If the query is very slow you will have to wait a long time. To solve the problem you can disable the automatic execution of … Continue reading AX / D365FO – Disable Auto execute Query on form startup
AX / D365FO – “NOT EXISTS” join on an AOT Query
If you need to create a relation between 2 tables using a NOT EXISTS JOIN on an AOT Query you can use the join mode property
AX / D365FO – Add CreatedOn, CreatedBy, ModifiedOn, ModifiedBy fields on a Table
Do you want to know when a table record has been created or modified? Or better know who has created it or modified it? You can do it by enabling these properties on a Table object : Created By = Yes Created date Time = Yes Modified By = Yes Modified Date Time = Yes … Continue reading AX / D365FO – Add CreatedOn, CreatedBy, ModifiedOn, ModifiedBy fields on a Table
AX / D365FO – How to Hide Enum values on a Form Lookup x++
Suppose you have a Form with an enum control ABC which contains values A,B,C. you want to hide last value of enum "C" while displaying it on the form. You have 2 ways to reach the result : Override the "Run" method in your Form (Preferred solution) public void run() { super(); YourEnumControl.delete(enum2str(ABC::C)); } Override … Continue reading AX / D365FO – How to Hide Enum values on a Form Lookup x++
SQL SERVER – Find Index Fragmentation status using the T-SQL statement
Use this SQL statement to fnd fragmented indexes SELECT S.name as 'Schema', T.name as 'Table', I.name as 'Index', DDIPS.avg_fragmentation_in_percent, DDIPS.page_count FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS DDIPS INNER JOIN sys.tables T on T.object_id = DDIPS.object_id INNER JOIN sys.schemas S on T.schema_id = S.schema_id INNER JOIN sys.indexes I ON I.object_id = DDIPS.object_id AND DDIPS.index_id … Continue reading SQL SERVER – Find Index Fragmentation status using the T-SQL statement
AX / D365FO – OR Condition in a Query Range object
Do you want to add an OR Query condition like (Field1 > 0 or Field2 >0) inside a complex AX SQL Statement using a Range object? Follow these steps : For this example I will use InventSum Table Add a range in the Data source Name it PhysicalInvent (no matter what's the name it's just … Continue reading AX / D365FO – OR Condition in a Query Range object
AX / D365FO – Clear infolog messages
To clear all infolog messages of a form just use infolog.cut() command. To get more details about this functionality you can read this article https://www.codecrib.com/2011/10/get-infolog-details-from-code.html
AX / D365FO – HOW TO SET QUICK FILTER IN D365 F&O
Here we will see couple of important property which needs to be filled for Filter to work. In Quick Filter control property 1.Target Control Property – Where we need to choose the Grid Control. 2.Default Column Property – Choose your desired column in Grid Without these set Filter wont work or list any columns. The … Continue reading AX / D365FO – HOW TO SET QUICK FILTER IN D365 F&O
AX / D365FO – SQL queries to get customers and vendor addresses and contact details
Below are the sample queries to get the vendors and customers addresses and contact details. Change the code according to your requirement. All VendorsSELECT * FROM VENDTABLE WHERE VENDTABLE.DATAAREAID='CEU' All Addresses - Vendor SELECT * FROM DirPartyPostalAddressView JOIN VENDTABLE ON DirPartyPostalAddressView.PARTY =VENDTABLE.PARTYWHERE VENDTABLE.DATAAREAID='XXX' All Addresses with PurposeSELECT LOGISTICSLOCATIONROLE.*,DirPartyPostalAddressView.*,VENDTABLE.* FROM DirPartyPostalAddressView JOIN VENDTABLE ON DirPartyPostalAddressView.PARTY =VENDTABLE.PARTYJOIN DIRPARTYLOCATIONROLE … Continue reading AX / D365FO – SQL queries to get customers and vendor addresses and contact details