May 06, 2017

Merger two LedgerDimension in Dynamics 365

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;
       //AccountingDistribution::
       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.

-Harry

May 04, 2017

New classes for Ledger/Default Dimensions in D365FO

Hi Folks,

Since many days, I was trying to perform few logics over LedgerDimensions and DefaultDimensions, like merge and replace etc. In AX2012 its handled by DiemsionDefaultingService class that having many static methods to help us to play around ledger/default dimensions.

But in Dynamics 365 FO , this class is deprecated, and MS introduce few more classes to help us with these requirements. Here are few names of classes and method that can be used.


1. LedgerDimensionFacade : 
This class used for fixed LedgerDimension, we have many static methods here, like Merge Dimension, getdefaultDimension and many more, refer below image.

image

2. LedgerDimensionDefaultFacade: 
This class will help us to perform an action over the default dimension. Like, Merge specify default dimension into a single default dimension, replace attribute value etc.

Please refer below image, 

image

Both classed having an almost same method that is available in AX with DiemsionDefaultingService class.


See Also,

How to merge two dimension

-Harry

April 15, 2017

How to setup Item coverage in Dynamics 365 FO

While performing some inventory transaction or MRP you may get this error “Item coverage is not fully updated.". We encounter this error because of default item coverage is not available for selected item and inventory dimension. Here is step by step guide to setup the item coverage for various inventory dimension.

Go to Master planning > Setup > Item coverage and Follow below steps to setup Item coverage.

Please note: few steps may differ on the basis of your selection during the wizard.


clip_image002
clip_image004
clip_image006
clip_image008
clip_image010
clip_image012
clip_image014
clip_image016
clip_image018

Enjoy…!!!

Harry













March 09, 2017

How to rename an Object in VisualStudio[Dynamics365/AX7]

Hi Folks,
Many times we need to duplicate an standard object and do the required changes and system gives warning while rename. Same caused error during project build.
 Problem: While renaming any object in Visual studio project system throw below warning
“Some of the files you are renaming or moving will be located outside of the project's binding root. The item(s) <objectName>.xml will not be source controlled if you continue with this rename.”
image
If you just continue with change , you may get errors while project/solution build.
Possible reason: If you are using TFS and this new object are not added to source code you’' will get this error.
Suggest Solution: Add this new object in Source control by right click on object and select “Add file  to source control”
image
Now you should be able to rename it.
This works for me perfectly. If you got some other solution to fix this issue plz keep share your feedback or links to other posts.
-Harry