web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

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

Dimension Value From Sales invoice Line

(0) ShareShare
ReportReport
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.

I have the same question (0)
  • Suggested answer
    Gianfranco C. Profile Picture
    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

  • Suggested answer
    YUN ZHU Profile Picture
    94,504 Super User 2025 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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,907

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,169 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,977 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans