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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to get from Approval Entry Table

(0) ShareShare
ReportReport
Posted on by 130

Hi BC Community,

How can I get from Approval Entry Table (454). Its PK is an entry No. which is not referenced (I think) anywhere else. So when I get....I can not find any records.

Any advice would be appreciated, my sample code is below:

trigger OnAfterGetRecord()
            begin
                if purchaseHeader.Get("Purchase Line"."Document Type", "Purchase Line"."Document No.") and (Type = Type::Item) then begin
                    approvalEntry.SetFilter("Document No.", purchaseHeader."No.");
                    if approvalEntry.get(approvalEntry."Entry No.") then
                        if purchaseInvoiceHeader.Get(purchaseHeader."Last Posting No.") then
                            if purchaseInvoiceLine.Get(purchaseInvoiceHeader."No.") then begin
                                purchaseInvoiceLine.Reset();
                                purchaseInvoiceLine.SetRange(purchaseInvoiceLine."Document No.");
                                if purchaseInvoiceLine.FindSet() then begin

                                end;
                            end;
                end
            end;

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi,

    I am not clear with your requirement what you are trying to achieve, can you please brief it more?

  • SammySevens Profile Picture
    130 on at

    Hi Nitin,

    I am trying to use a GET method on the approval entry table (454). The issue I see is that the PK for approval table is the "entry no", no table I am aware of references this field. So what variable can i put in approvalEntry.GET(). I currently have access to purchase header, purchase line. 
    Hope that helps to clarify
  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi,

    Your declaration of set filters are wrong please try below

     trigger OnAfterGetRecord()
        begin
            if purchaseHeader.Get("Purchase Line"."Document Type", "Purchase Line"."Document No.") and (Type = Type::Item) then begin
                approvalEntry.SetFilter("Document No.", purchaseHeader."No.");
                if approvalEntry.findfirst then
                    if purchaseInvoiceHeader.Get(purchaseHeader."Last Posting No.") then
                        if purchaseInvoiceLine.Get(purchaseInvoiceHeader."No.") then begin
                            purchaseInvoiceLine.Reset();
                            purchaseInvoiceLine.SetRange(purchaseInvoiceLine."Document No.");
                            if purchaseInvoiceLine.FindSet() then begin
    
                            end;
                        end;
            end
        end;

  • SammySevens Profile Picture
    130 on at

    That's cool, I will try that.

    Can I ask, am I able to use GET / FINDFIRST to get records from a table? I am only used to using GET.....i guess there are other methods?

  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Get only works with Primary key and does not findfirst along,

    we have FINDFIRST, FINDSET, FINDLAST.

    You can follow the below link to understand them better

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-find-method

    pastedimage1681180187522v1.png

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 2,785

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,007 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 948 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans