Friday, 30 November 2018

Job to combine main account and default dimension to get ledger Dimension in D365FO

In this blog I will discuss how we can combine main account and default dimension to get ledger dimension in D365FO. So let's begin, please follow below screen shots.

For achieving this I have created a Job in which I have three methods, which I have call in my main method.

Main() Method:

Source Code Explanation:
  • Set main account (in my case '61170005').
  • Set default dimension (in my case '68719489575').
  • Pass it into CombineMainAccoutAndDefaultDimension() method.
GetDimensionAttriuteName() Method:

Source Code Explanation:
  • Get dimension cache.
  • Iterate dimension attribute Set Item to get dimension attribute except main account.
  • Return dimension attributes container.


















GetDimensionAttributeValue() Method:


Source Code Explanation:
  • Find dimension attribute value set storage through default dimension.
  • Get display value by dimension attribute from dimension storage.










CombineMainAccoutAndDefaultDimension() Method:


Source Code Explanation:
  • Initialize and declare objects.
  • Get container which holds dimension attributes. (Get from previous getDimensionAttriuteName() method).
  • Iterate dimension attributes and get its values. (Get dimension values from previous getDimensionAttributeValue() method).
  • Pass attribute name and value in dimension attribute value contract.
  • Pass main account and value contract object in ledger account contract class.
  • Through dimension service provider get dimension storage.
  • Get dimension value combination of main account and default dimension.
  • Return value combination record id which is Ledger Dimension.
 

Result:









This example is taken from this Microsoft community post Combine main account with default dimension to ledger dimension

No comments:

Post a Comment

Set up Online VM for Dynamics 365 Finance and Operation for Technical and Functional Learning Purposes

In this blog, I will discuss how we set up an online VM for D365F&O for Technical and Functional learning purposes for free. Step: 1 Cl...