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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

How to display both Item Type and GL Type in Posted purchase invoices list page in Business central

(0) ShareShare
ReportReport
Posted on by 86

Hi,

     Need to show item and GL description from posted purchase invoice page to Posted purchase invoices list page.

pageextension 50102 PurchaseItemDescription extends "Posted Purchase Invoices"
{
    layout
    {

        addbefore("Currency Code")
        {
            field(ItemName; ItemName)
            {
                ApplicationArea = All;
                Caption = 'Item Name';
            }
        }
    }
    trigger OnAfterGetRecord()
    var
        PurchInvLine: Record "Purch. Inv. Line";
    begin
        PurchInvLine.Reset();
        PurchInvLine.SetRange("Document No.", Rec."No.");
        PurchInvLine.SetRange(Type, PurchInvLine.Type::Item);
        if PurchInvLine.FindSet() then begin
            ItemName := PurchInvLine.Description
        end

        else
            ItemName := '';
    end;

    var
        ItemName: Text;

}
If i run the above code, I can able to show item description in posted purchase invoices list page. 
pastedimage1682490189067v1.png
I also need to show GL type description, so i added the code as:
 
PurchInvLine.SetRange(Type, PurchInvLine.Type::"G/L Account");
pastedimage1682490324154v3.png
The above screenshot showing only GL Type description. But i want to show both item and GL Type description. How to set filter or range to show both item and GL Type description?
 

 

  • Verified answer
    Govinda Kumar Profile Picture
    2,310 Moderator on at

    Hi,

    Do you mean that you want to use the same field to show both the GL Description and Item Description? For example, if the type is GLType, it shows the GL Type Description, and if the type is Item, it shows the Item Description. To achieve this, you simply need to get another table buffer for the G/L account and use it in an 'else if' condition, like this

    pastedimage1682492026261v1.png

    pastedimage1682492152621v2.png

    trigger OnAfterGetRecord()
        var
            PurchInvLine: Record "Purch. Inv. Line";
            PurchInvLine2: Record "Purch. Inv. Line";
        begin
            PurchInvLine.Reset();
            PurchInvLine2.Reset();
            PurchInvLine.SetRange("Document No.", Rec."No.");
            PurchInvLine.SetRange(Type, PurchInvLine.Type::Item);
            PurchInvLine2.SetRange("Document No.", Rec."No.");
            PurchInvLine2.SetRange(Type, PurchInvLine.Type::"G/L Account");
            if PurchInvLine.FindSet() then begin
                ItemName := PurchInvLine.Description
            end
            else
                if PurchInvLine2.FindSet() then begin
                    ItemName := PurchInvLine2.Description
                end
                else
                    ItemName := '';
        end;

    Hope it helps..

    Regards

  • Suggested answer
    NAV_with_Narang Profile Picture
    2,410 Moderator on at

    Hi Revathi - I am not sure why anyone would want to do that, it goes against the whole design of Purchase Invoices Header & Line concept. If the customer wants to see the lines description without opening each Posted Purchase Invoice card, I'd suggest create a factbox and display it on the factbox pane of Posted Purchase Invoice list on the right hand side. Whenever the user selects a PPI 108215 on this list in the last screenshot, they'll be able to see the corresponding line descriptions on the right hand side factbox immediately without opening the card page. You can choose to also display only the description of each line in this factbox

    Even if you are able to code your necessary requirements, it will definitely backfire. I can think of many cases where the approach you are taking may absolutely not work

  • Revathi.T Profile Picture
    86 on at

    Thank you for the support. It works now. I can able to show both item and GL description using table buffer.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 554 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 360 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 201 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans