# DefaultValue ComboBox in Dynamics AX with X++

Beside modify metadata on form properties, as best practice we can use code like below to assign default value for combobox. You can use this code in the form’s init method after super(): 1 ComboBoxName.selection(ComboBoxName::DefaultValue); If this is a table field we should you best practice overriding the initValue method in the table: 1 this.ComboBoxName = ComboBoxName::DefaultValue; Override initValue in the form’s datasource only if it should be a specific behaviour in this form only.

# Rename a Database in SQL Server

Open Microsoft SQL Server Management Studio. Connect to the server where in the DB you want to rename is located. Modify the following script and run it 1 2 3 4 5 6 7 8 9 10 11 -- Replace all MyDBs with the name of the DB you want to change its name USE[MyDB];-- Changing Physical names and paths -- Replace all NewMyDB with the new name you want to set for the DB -- Replace 'C:.

# Web Services on IIS - Exception has been thrown by the target of an invocation

When I try to install Web Services on IIS for Retails POS Component, and I got the problem.

This scenario shouldn’t be common in a production environment, but, it is indeed quite common in a VM machine (I’m using virtual machine Hyper-V on Windows 8.1)

# Modify Microsoft Dynamics AX 2012 R3 SSRS configurations using PowerShell

reportManagerWebConfig.ps1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #Modify the Report Server Web.config file. ie replace MSRS11.VAS with your folder name Set-ExecutionPolicy Unrestricted $webConfig = "C:Program FilesMicrosoft SQL ServerMSRS11.VASReporting ServicesReportManagerWeb.config"$currentDate = (get-date).tostring("mm_dd_yyyy-hh_mm_s") # month_day_year - hours_mins_seconds $backup =$webConfig + "_$currentDate"$doc = new-object System.Xml.XmlDocument $doc.Load($webConfig) #save a backup copy $doc.Save($backup) Write-Host "Backup saved as " + $backup$node = \$doc.

# AxBuild.exe for Parallel Compile on AOS

If you have only 10 mins to build ax, try this In AOS server, go to C:\Program Files\Microsoft Dynamics AX\60\Server\DAX\bin and open cmd from here then run this command 1 axbuild.exe xppcompileall /s=01 /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin" /s is your AOS number instance, you can check it in windows services /altbin the path to AX client Result Once compile complete, you can import compile log file at C:\Program Files\Microsoft Dynamics AX\60\Server\DAX\log into compiler output of AX client

# List Page Interaction Class

Form interaction classes that allow user interface control logic to be shared across forms. For instance, controlling which buttons are available to a list page and the associated detail form.

The interaction classes are extending a base ListPageInteraction class. This has some methods supported by the kernel to interact e.g. with initializations of the list page form. Other classes can be build stand alone to execute e.g. a batch process or represent a web service or posting classes.

Form interaction classes are not mandatory for list pages but should be used on data entry forms that require logic. This ensures consistency and allows easier maintenance of logic.

This class inherits from SysListPageInteractionBase, here is some methods we need to know

• initializing: Called when the form is initializing – Similar to the form init method

• intializeQuery: Also called when the form is initializing – Similar to the datasource init method.

• selectionChanged: Called when the active record changes – Similar to the datasource active method.

• setButtonEnabled: Should be overridden to dynamically enable/disable buttons based on the current selection. This is called from the selectionChanged method.

# Execute external database Stored Procedure from X++ code using ODBC connectivity

This is to show a method to execute external database stored procedures from X++ code. Create a job in AOT with following code. Follow the steps as explained here in the code like replace Server Name, Database name , Stored Procedure name. The below code is executed through the ODBC Connection. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 static void execExternalDatabase(Args _args) { LoginProperty loginProperty; ODBCConnection odbcConnection; Statement statement; ResultSet resultSet; ResultSetMetaData resultSetMetaData; Counter counter; str sql; SqlStatementExecutePermission perm; ; loginProperty = new LoginProperty(); loginProperty.

# How to deploy all the reports in AX2012 by using Management Shell

Login to the AX AOS server and follow below steps. Click Start > Administrative Tools. Right-click the Microsoft Dynamics AX 2012 Management Shell option. Click Run as administrator. Go to PowerShell command prompt and run with command Publish-AXReport –ReportName * Wait up to getting Deployment successful message in command prompt.