Posts

Showing posts from 2017

Solution to Ax Batch Service Exception with the help of Event Viewer

Image
Recently while working with batch processing in Update8 I could not start the batch service. It was working and at some point it stopped running. I used the handy Event Viewer to find out what the issue was. The warning message in the Event Viewer shows that it's trying to start the BatchService in MaintenanceMode. So I turned off maintenancemode with the following command: J:\AosService\PackagesLocalDirectory\Bin\Microsoft.Dynamics.AX.Deployment.Setup.exe --metadatadir J:\AosService\PackagesLocalDirectory --bindir J:\AosService\PackagesLocalDirectory\Bin --sqlserver . --sqldatabase axdb --sqluser axdbadmin --sqlpwd ********* --setupmode maintenancemode --isinmaintenancemode false Reference: https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/sysadmin/maintenance-mode And it starts running... I've been using Event Viewer more often now to make sense of runtime errors that are too vague.

Override a System Defined Refresh button in D365O

Image
Essentially this post is going to discuss calling custom code while refreshing a form in D365O, however, you can find more information about other system defined buttons and how you can run extra code or suppress them in this article:  System-Defined buttons Firstly the datahelper() method of the formRun framework class can be used to provide services that allow managing the datasources of the form. How can I add custom code to run when I click refresh? We are going to use eventing (pre-event handler and post-event handler) to do this: 1. Write your method that you want to call when the refresh button is clicked 2. In the Form.int subscribe using the datahelper().Refreshing event 3. On refresh click you'll see your message

Right-Click Context Menu in D365O on a Tree control

Image
AX 2012 used the PopupMenu class to create a right-click context menu. In D3650, Microsoft has done away with that and introduced the ContextMenu API which can be used to do the same thing. You can override the form control methods and use the  getContextMenuOptions  to create context menu options and override the  selectedMenuOption method  to select the menu options. Demo: AOTName - CostSheetDesigner form CostsheetDesignerCtrl is a class that helps to creates the context menu options "Cut", "Copy" and "Paste" in the createContextMenu and allows selection in selectContextMenuOption methods. Override form control method To create menu options in the CostsheetDesignerCtrl class Now for the selection: Override form control method Calls this method in the CostSheetDesignerCtrl class And the Right-click context menu in the form with the "Cut" and "Copy" options:

New Print Destination in Dynamics 365 for Operations

Image
A customization may require you to add a new report print destination. With the help of delegates and extensions it's quite simple to achieve that in D365FO: 1. Create an extension of the BaseEnum SRSPrintMediumType and add your new report destination: 2. Create your class which will have your customization relating to your new destination. Now subscribe to the delegate method onPrintReport in SRSPrintDestinationSettingsDelegates class and add your custom code: 3. Create an extension for SRSPrintDestinationSettingsForm and add your tabpage for your new destination: 4. Next thing is to add the code that will build your destination Tabpage and your destination list. This can be done by subscribing to the delegate methods in SRSPrintDestinationSettingsDelegates class: Code for print medium type change event on the destination form Code for building SendTo list control on the destination form Code for the index selection

Dimension Entry Controls in Dynamics 365 for Operations

Image
In Dynamics 365 for Operation adding dimension controls to Forms has been changed a bit so that all forms interact only with the Dimension Entry control instance API and not directly with the controller classes eg. LedgerDefaultDimensionEntryController, etc. These are some of the changes I've noticed while upgrading Ax 2012 to D365FO: 1. Add the Dimension Entry form control and set the properties 2. While upgrading these are some of the differences I found between Ax 2012 and D365FO: Ax 2012 dimensionDefaultingController = DimensionDefaultingControllerNoDS::constructInGroupWithValues(true, true, true, 0, this, dimensionsGroup, "@SYS138487", legalEntity.text()); D365FO DimensionEntryControl.parmDisplayValues(true); DimensionEntryControl.parmCompany(legalEntity.text()); DimensionEntryControl.reactivate(); Ax 2012 dimensionDefaultingController.pageActivated(); dimensionDefaultingController.loadValu