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.

DimensionMerge

PurchLine::mergeDimension
{
return _dimensionMerge.merge(_primaryDefaultDimension, _secondaryDefaultDimension);
}
public DimensionDefault mergeDimension(
DimensionDefault _primaryDefaultDimension,
DimensionDefault _secondaryDefaultDimension = 0,
DimensionMerge _dimensionMerge = DimensionMerge::newFromTable(this,
this.companyInfo().RecId
)
)
{
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*

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...