19 March 2018

How to get the form control access using event handler in D365 or AX7

CustTable custTable = sender.cursor(); // args.getThis() as CustTable;
FormDataSource custTable_ds = sender.formRun().dataSource("CustTable");
FormRun element = sender.formRun();
FormControl myNewControl = element.design(0).controlName("myControl");

21 February 2018

AX7 : D365 : How to merge ledger and financial dimensions using X++ code in AX 7 : D365

In D365 there is a new class for financial dimension merging. Return the default dimension id.


return _dimensionMerge.merge(_primaryDefaultDimension, _secondaryDefaultDimension);
public DimensionDefault mergeDimension(
DimensionDefault _primaryDefaultDimension,
DimensionDefault _secondaryDefaultDimension = 0,
DimensionMerge _dimensionMerge = DimensionMerge::newFromTable(this,
return _dimensionMerge.merge(_primaryDefaultDimension, _secondaryDefaultDimension);

Below is the method where the parameters are passing and return final default dimension Id.

DimensionDefault mergedDimensionDefault;
DimensionCopy dimensionCopy;

// Now merge the dimensions
mergedDimensionDefault = LedgerDimensionDefaultFacade::serviceMergeDefaultDimensions(
_dimensionDefaultMap.DefaultDimension, // Values that are currently on the record
_defaultDimension1, // Input value 1
_defaultDimension2); // Input value 2

20 February 2018

MS SQL Server Database restore error "Database is in use"

Check this to skip this error: Close existing connections to destination database

D365 or AX7 events to get current record or other database record in form

[FormDataFieldEventHandler(formDataFieldStr(InventTransRegister, TmpInventDim, inventBatchId), FormDataFieldEventType::Validating)]
public static void inventBatchId_OnValidating(FormDataObject sender, FormDataFieldEventArgs e)
FormDataSource tmpInventDim_ds = sender.datasource();
InventDim tmpInventDim = tmpInventDim_ds.cursor();
TmpInventTransWMS tmpInventTransWMS = tmpInventDim_ds.formRun().dataSource("TmpInventTransWMS").cursor();

Info(strFmt("Batch number %1-%2-%3",tmpInventDim.inventBatchId,tmpInventTransWMS.ItemId, tmpInventTransWMS.InventDimId));

01 February 2018

AX7: D365: Deploy All SSRS reports manually using command prompt

To deploy all SSRS reports:

Open Windows PowerShell in the VM
Run this command:
K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "K:\AosService\PackagesLocalDirectory"

Note: Depending on path in your virtual machine you can switch between K: or the appropriate drive.

To deploy single report use the below command in PowerShell:

K:>AosService>PackagesLocalDirectory>Plugins>AxReportVmRoleStartupTask>.\DeployAllReportsToSsrs.ps1 -PackageInstallLocation "K:\AosService\PackagesLocalDirectory" -Module ApplicationSuite –ReportName.Report

Note: Where ReportName.Report is your report name with its design.

To deploy specific reports through PowerShell:

To deploy report whose name starts from say “PSAProjInvoice”, use a command as below,

K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -Module ApplicationSuite -ReportName PSAProjInvoice*

31 January 2018

Data management – financial dimensions import in D365 / AX7 Define financial dimension formats for data entities

How to import financial dimension values in Sales order import using data entity.

AX > General ledge > Chart of accounts > Dimensions > Financial dimension configuration for integrating applications

After setting the default dimensions - We have to fill the values in Data entity tempalte as shown below.


Structure: DepartMent - CostCenter - Purpose

Values in Excel cell: Dept1-Cost1-pur1

How to get the form control access using event handler in D365 or AX7

CustTable custTable = sender.cursor(); // args.getThis() as CustTable; FormDataSource custTable_ds = sender.formRun()....