Merger two LedgerDimension in Dynamics 365 – ww12345678 的部落格 | AX Helper
最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

Merger two LedgerDimension in Dynamics 365

网络文摘 William 518浏览 0评论
Hi Folks,
In my previous post I shared  information about new classed that introduced in D365 for Dimension actions. In this post I am sharing a sample code to merge two different ledger dimension and get a new LedgerDimension id.
This is rough code , please feel free to copy and update it according to your requirement.
public static void main(Args _args)
       LedgerJournalTrans  ledgerJournalTrans1, ledgerJournalTrans2 ;
       RefRecId            dim1, dim2, mergerDim;
       select firstonly TrvExpTrans where TrvExpTrans.ExpNumber == "USMF-000565";
       select firstonly AccountingDistribution where AccountingDistribution.SourceDocumentLine == SourceDocumentLine::find(TrvExpTrans.SourceDocumentLine).RecId;
       dim1 = TrvCostType::find("mycategory").LedgerDimension; //First dimension
       dim2 = 5637236123;//AccountingDistribution.LedgerDimension; //Second dimension
       mergerDim = LedgerDimensionFacade::serviceMergeLedgerDimensions(dim1, dim2);
      info(strFmt("Dim1: %1" , DimensionAttributeValueCombination::find(dim1).DisplayValue));
      info(strFmt("Dim2: %1" , DimensionAttributeValueCombination::find(dim2).DisplayValue));
      info(strFmt("merge dim: %1", DimensionAttributeValueCombination::find(mergerDim).DisplayValue));
Please share your queries/feedback in comment box, I will be happy to help you.



  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址