Showing posts with label Dimensions. Show all posts
Showing posts with label Dimensions. Show all posts

Monday, November 16, 2026

get mainaccount ledger dimension recid from mainaccount

 Info(strFmt("%1",LedgerDimensionFacade::serviceCreateLedgerDimension(LedgerDefaultAccountHelper::getDefaultAccountFromMainAccountId(Yourmainacoountid))));


note:- method name will be having create key word that dosent meen it will create a new ledgerdimensionrecid everytime, method has logic first it will check existing one in system if not then it will create

Thursday, April 30, 2026

Get all Dimensions values with - separated with provided dimension recid

 To get all dimension with - separated with provided dimension recid

Code:-

public static str Getdimensionset(RecId recid)
{
     str                                 descriptionLedgerLoc = '';
     boolean                             first = true;
     DimensionAttributeLevelValueAllView view,viewloc;
     DimensionAttributeValue             dimValue;
     DimensionAttributeValueGroup        dimensionAttributeValueGroup;
     container                           con;

     select firstonly viewloc
         where viewloc.ValueCombinationRecId==recid;

 

     while select view order by view.ValueOrdinal asc
      where view.ValueCombinationRecId == recid
&& view.DimensionAttributeValueGroup==viewloc.DimensionAttributeValueGroup
     {

         if (!first)
         {
             descriptionLedgerLoc += " - ";
         }
         descriptionLedgerLoc +=view.DisplayValue ;
         first = false;


     }
     return descriptionLedgerLoc;
}


Note:-dimensions will get with - separated

Thank you!!

Get dimensions values with provided dimension Recid

 To get Dimensions value as displayed in Control level 

Code:-

LedgerDimensionFacade::getDisplayValueForLedgerDimension(DimensionRecid);

Note:- dimensions will get with ~ separated

Thank you!!

Tuesday, December 9, 2025

Get ledger dimension description beside dimension in d365fo x++

 In this blog we learn how to Get ledger dimension description beside dimension in d365fo x++


Step1)write a display method in table and give in formdatasource

logic:-

       [ExtensionOf(tableStr(BudgetTransactionLine))]

internal final class DaxBudgetTransactionLine_Extension
{
        public display str descriptionLedger()
    {
        str                                 descriptionLedgerLoc = '';

     boolean                             first = true;
     DimensionAttributeLevelValueAllView view,viewloc;
     DimensionAttributeValue             dimValue;
     DimensionAttributeValueGroup        dimensionAttributeValueGroup;
     container                           con;

 

     select firstonly viewloc
         where viewloc.ValueCombinationRecId==this.LedgerDimension;


     while select view order by view.ValueOrdinal asc 
         where view.ValueCombinationRecId == this.LedgerDimension 
&& view.DimensionAttributeValueGroup==viewloc.DimensionAttributeValueGroup

     {
         dimValue = DimensionAttributeValue::find(view.AttributeValueRecId);

         if (!conFind(con,view.AttributeValueRecId))
         {
             con += [view.AttributeValueRecId];
             if (dimValue)
             {
                 if (!first)
                 {
                     descriptionLedgerLoc += " - ";
                 }

                 descriptionLedgerLoc += dimValue.getName();
                 first = false;
             }
         }
     }

     return descriptionLedgerLoc;
}

}

 

 

 Output:-

Tuesday, October 22, 2024

Dimensions

 Financial Dimensions:-

 Create financial  Dimensions through code:-

 DimensionAttributeValueSetStorage   valueSetStorage= new DimensionAttributeValueSetStorage();

 DimensionAttribute      dimensionAttribute; 

DimensionAttributeValue dimensionAttributeValue;

 dimensionAttribute = dimensionAttribute::findByName("CostCenter"); 

dimensionAttributeValue =dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,"020",false,true);

 valueSetStorage.addItem(dimensionAttributeValue); 

this.DefaultDimension=valueSetStorage.save();


get mainaccount ledger dimension recid from mainaccount

 Info(strFmt("%1",LedgerDimensionFacade::serviceCreateLedgerDimension(LedgerDefaultAccountHelper::getDefaultAccountFromMainAccount...