dynamics-ax-2012

dynamics ax : Push Customized form to All users

空扰寡人 提交于 2019-12-06 19:31:31
Recently, I was troubleshooting an issue related to user settings. There was a requirement to migrate the user settings from one environment to another. There is an AX 2009 form which users make their own personalisations to, moving some of the fields around, or perhaps adding other fields (via the right click->setup functions) , so that unnecessary fields are hidden. I have saved that form , so that it is available for me , but when i migrate the form to another environment i notice that the new user don't have any change on the form. As we all know, User related setups for queries, forms,

How to get a Common object from a table id?

送分小仙女□ 提交于 2019-12-06 15:55:56
How to instantiate a common type object (the table's base class in AX) via a TableId ? Furthermore what else can we do with TableId? My goal is to send tableid to my method and there, I will make the buffer of the table the id belongs to. Is it possible? It can be done like this: public static Common makeRecord(TableId _tableId) { return new DictTable(_tableId).makeRecord(); } maqk Yes you can do this. Here is a webpage explaining: http://www.doens.be/2009/07/select-a-record-from-a-table-when-you-only-have-the-tableid/ 来源: https://stackoverflow.com/questions/10095415/how-to-get-a-common-object

Make order by with Query in AOT

自闭症网瘾萝莉.ら 提交于 2019-12-06 11:13:07
I have made a query in AOT. My goal is to print information using Group by "CustGroup" and Order by "count(RecId)" desc of CustTable table. The group by works properly, but the order by does not. I can not understand why... This is what my query looks like: This is code I use: Static void Query(Args _args) { QueryRun qr; CustTable myCustTable; ; qr = new QueryRun(queryStr(MyQuery)); while(qr.next()) { myCustTable = qr.get(tableNum(CustTable)); info(strFmt("Group %1 Num %2", myCustTable.Custgroup, myCustTable.RecId)); } } The result is: AX does not sort by Count(RecId) but by the grouping. You

How to mimic the AOT Export by layer functionality X++?

我的未来我决定 提交于 2019-12-06 06:33:52
I am attempting to programmatically duplicate the following steps in X++ In the AOT Tree right click on the root node and click "Export" Provide a file name Click the "Application object layer" checkbox Specify "cus" as the Application object layer Export the XPO to the file I've gotten as far as bring able to export entire AOT tree but I can't figure out a way to narrow it down to just the cus layer. Here is my current code sample ... TreeNode treeNode; FileIoPermission perm; #define.ExportFile(@"c:\XPO\AOTCusExport.xpo") #define.ExportMode("w") ; perm = new FileIoPermission(#ExportFile,

Change the background color of a column in a grid

我怕爱的太早我们不能终老 提交于 2019-12-05 15:40:38
I have following form and I want to change the background color of a column, based on the values of other columns; In the orange columns, instead of displaying orange background, I want the cell color to be the RGB combo of Red, Green & Blue fields under COLOR ATTRIBUTES section. Let's say that the control the background of which you need to change is named FirstFieldControl. Set its AutoDeclaration property to Yes and BackgroundColor to Window background . Now you need to override the displayOption method on your datasource, e.g.: public void displayOption(Common _record, FormRowDisplayOption

How to do unit testing in Microsoft Dynamics AX 2012 in a real world project

半世苍凉 提交于 2019-12-04 13:54:18
问题 Dynamics AX 2012 comes with unit testing support. To have meaningful tests some test data needs to be provided (stored in tables in the database). To get a reproducable outcome of the unit tests we need to have the same data stored in the tables every time the tests are run. Now the question is, how can we accomplish this? I learned that there is the possibility of setting the isolation level for the TestSuite to SysTestSuiteCompanyIsolateClass . This will create an empty company and delete

How to create a lookup with fields from more than one datasource?

谁说胖子不能爱 提交于 2019-12-04 11:56:08
I need to create Dynamic lookup in my form field which should display fields from two different datasources.. I am trying to perform it as: public void lookup() { query = new Query(); sysTableLookup = SysTableLookup::newParameters(tableNum(smmBusRelTable), this); qbds = query.addDataSource(tablenum(smmBusRelTable)); // qbds.addDataSource(tableNum(DirPartyTable)); //qbds.relations(true); sysTableLookup.parmQuery(query); sysTableLookup.addLookupField(fieldNum(smmBusRelTable, Busrelaccount)); //sysTableLookup.addLookupfield(fieldNum(DirPartyTable, Name)); sysTableLookup.performFormLookup(); }

Table Update Event Handler

给你一囗甜甜゛ 提交于 2019-12-04 07:48:46
I am investigating the capabilities of the new delegate & event subscription pattern in AX 2012. At the moment I am looking to detect when a particular field has been modified, for example when SalesTable.SalesStatus is changed to SalesStatus::Invoiced . I have created the following post-event handler and attatched to the SalesTable.Update method; public static void SalesTable_UpdatePosteventHandler(XppPrePostArgs _args) { Info("Sales Update Event Handler"); } Now I know I can get the SalesTable from the _args , but how can I detect a field has changed? I could really use a before & after

How to do unit testing in Microsoft Dynamics AX 2012 in a real world project

别来无恙 提交于 2019-12-03 08:01:35
Dynamics AX 2012 comes with unit testing support. To have meaningful tests some test data needs to be provided (stored in tables in the database). To get a reproducable outcome of the unit tests we need to have the same data stored in the tables every time the tests are run. Now the question is, how can we accomplish this? I learned that there is the possibility of setting the isolation level for the TestSuite to SysTestSuiteCompanyIsolateClass . This will create an empty company and delete the company after the tests have been run. In the setup() method I can fill my testdata into the tables

Update records that can be retrieved by multiple joins in x++

大兔子大兔子 提交于 2019-12-02 08:53:10
So I have a complete x++ script that aims to update records based on the retrieved result set made with select query with multiple joins and using crosscompany As I have been told, it is not a good idea to update records when there is crosscompany. Can you give expert advice on how to do it the best practice way considering my current script. here is the script static void UpdateSample(Args _args) { InventTable a; InventTableModule b; EcoResProduct c; EcoResProductCategory d; EcoResCategory e; EcoResCategoryHierarchy f; int i = 0; while select crossCompany a exists join b where a.ItemId == b