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...
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 76

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?
 

 

I have the same question (0)
  • Verified answer
    Govinda Kumar Profile Picture
    2,304 Moderator on at
    RE: How to display both Item Type and GL Type in Posted purchase invoices list page in Business central

    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,294 Moderator on at
    RE: How to display both Item Type and GL Type in Posted purchase invoices list page in Business central

    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
    76 on at
    RE: How to display both Item Type and GL Type in Posted purchase invoices list page in Business central

    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

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,377

#2
Jainam M. Kothari Profile Picture

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

#3
YUN ZHU Profile Picture

YUN ZHU 1,512 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans