Skip to main content

Notifications

Announcements

No record found.

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;

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: How to get from Approval Entry Table

    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

  • SammySevens Profile Picture
    SammySevens 130 on at
    RE: How to get from Approval Entry Table

    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
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: How to get from Approval Entry Table

    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
    SammySevens 130 on at
    RE: How to get from Approval Entry Table

    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
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: How to get from Approval Entry Table

    Hi,

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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans