Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Dimension Value From Sales invoice Line

Posted on by 50

Hi All,

 I am doing Aging report for that report i had a column named Project name  it is the dimension value from shortcut dimension 4, if the customer ledger entries source code field is set to sales then i want project name from the salesinvoice line. i am writing my code from onaftergetrecord of customer ledger entry but it is not coming, correctly can anyone help me.

 if CustLedgEntryEndingDate."Source Code" = 'Sales' then begin

                            GLSetup.Get();

                            DeimensionSetEntry.Reset();

                            DeimensionSetEntry.SetRange("Dimension Code", GLSetup."Shortcut Dimension 4 Code");

                            DeimensionSetEntry.SetRange("Dimension Set ID", SalesInvLine."Dimension Set ID");

                            if DeimensionSetEntry.FindFirst() then

                                Var_JobNo := DeimensionSetEntry."Dimension Value Code";

                            DimensionValue.Reset();

                            DimensionValue.SetRange(code, Var_JobNo);

                            if DimensionValue.FindFirst() then

                                Var_JobNo := DimensionValue.Name;

                        end;

Thanks & Regards,

Satish.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,035 Super User 2024 Season 2 on at
    RE: Dimension Value From Sales invoice Line

    Hi, hope the following can give you some hints.

    Dimension Set Entries Overview

    https://learn.microsoft.com/en-us/dynamics365/business-central/design-details-dimension-set-entries-overview

    Thanks.

    ZHU

  • Suggested answer
    Gianfranco C. Profile Picture
    Gianfranco C. 370 on at
    RE: Dimension Value From Sales invoice Line

    hi, try this code:

        procedure GetDimValueName(var  DimValueName: Text[50]) 
        var
            CustLedgEntryEndingDate: Record "Cust. Ledger Entry";
            GLSetup: Record "General Ledger Setup";
            DimensionSetEntry: Record "Dimension Set Entry";
            SalesInvLine: Record "Sales Invoice Line";
            DimensionValue: Record "Dimension Value";
            DimValueCode: Code[20];
           
        begin
            if CustLedgEntryEndingDate."Source Code" = 'Sales' then begin
    
                GLSetup.Get();
    
                DimensionSetEntry.Reset();
                DimensionSetEntry.SetRange("Dimension Code", GLSetup."Shortcut Dimension 4 Code");
                DimensionSetEntry.SetRange("Dimension Set ID", SalesInvLine."Dimension Set ID");
                if DimensionSetEntry.FindFirst() then begin
                    DimValueCode := DimensionSetEntry."Dimension Value Code";
    
                    if DimensionValue.get(GLSetup."Shortcut Dimension 4 Code", DimValueCode) then
                        DimValueName := DimensionValue.Name;
                end;
            end;
        end;

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

    Thanks & Regards,
    Gian

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,134 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,928 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans