26 May 2022

Getting Dimension value and description from default dimension in D365FO

 DefaultDimensionView    defaultDimensionView;

    
    select defaultDimensionView
        where defaultDimensionView.DefaultDimension == _defualtDimension//recId
        && defaultDimensionView.Name == 'CostCenter';    

    info(defaultDimensionView.displayvalue);
info(defaultDimensionView.dimensionDiscription());

============================================================

DefaultDimensionView dimensionView;
        DimensionAttribute dimensionAttribute;

        select firstOnly dimensionView
            where dimensionView.DefaultDimension == 5637146834
        join dimensionAttribute
            where dimensionView.Name == dimensionAttribute.Name
            && dimensionView.Name == 'Costcenter';

        info(dimensionView.DisplayValue);

        info(strFmt("Display value= %1",dimensionView.dimensionDiscription()));

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...