Purpose:
The purpose of this document is to demonstrate how we can Split ledger account into separate field values using ledger dimension field from general journal account entry X++ based on a business logic.
Product:
Dynamics 365 for Finance and Operations, Platform Update 9.
Development approach:
Customization through Table COC , we need to Split ledger account into separate field values using ledger dimension field from general journal account entry
Development:
Create a Class and added main method to get dim value based on dimension and attribute name to identify values from ledger dimension field from general journal account entry table.
Please find the method definition as follows.
Public class testclass
{
generaljournalentry accountEntry;
select firstonly accountEntry where accountEntry.SubledgerVoucher == "test23"
TestTable.DimBillability = this.dimValue(accountEntry.LedgerDimension, "Billability");
TestTable.DimCashFlow = this.dimValue(accountEntry.LedgerDimension, "CashFlow");
TestTable.DimBusinessunit = this.dimValue(accountEntry.LedgerDimension, "BusinessUnit");
TestTable.DimCompany = this.dimValue(accountEntry.LedgerDimension, "Company");
TestTable.DimCompetency = this.dimValue(accountEntry.LedgerDimension, "Competency");
TestTable.DimCustomer = this.dimValue(accountEntry.LedgerDimension, "Customer");
TestTable.DimCustomerSite = this.dimValue(accountEntry.LedgerDimension, "CustomerSite");
TestTable.DimMainAccount = this.dimValue(accountEntry.LedgerDimension, "MainAccount");
TestTable.DimProject = this.dimValue(accountEntry.LedgerDimension, "Project");
TestTable.DimVendor = this.dimValue(accountEntry.LedgerDimension, "Vendor");
TestTable.DimWorker = this.dimValue(accountEntry.LedgerDimension, "Worker");
}
/// <summary>
/// Resturn dimension value based on default dimension and dimension value name
/// </summary>
/// <param name = "_ledgerDimension"></param>
/// <param name = "_name">_name</param>
/// <returns>Dimension Value</returns>
public DimensionValue dimValue(LedgerDimensionAccount _ledgerDimension, Name _name)
{
DimensionAttributeLevelValueView valueView;
DimensionAttribute dimAttribute;
select firstonly DisplayValue from valueview
where valueView.ValueCombinationRecId == _ledgerDimension
join dimAttribute
where dimAttribute.RecId == valueView.DimensionAttribute
&& dimAttribute.Name == _name;
return valueview.DisplayValue;
}
}
Comments
Post a Comment