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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

No matter what I do temporary table in subform doesn't refresh unless using an action

(0) ShareShare
ReportReport
Posted on by

I have managed to get a subform page part working successfully. It displays data sourced from a temporary table that is initialised and loaded using a procedure in a code unit that takes parameters and is called from the main page.

Here is my issue. It works perfectly if I call the procedure explicitly from within an Action defined on the page. However, no matter what page event I put it on.

Here is the action.

 action("Load Temp Table")
            {
                ApplicationArea = All;

                trigger OnAction()
                var
                    myInt: Integer;
                begin

                    CurrPage.Lines.Page.InitTempTable(xrec."Order Reference", xrec."Landed Cost Template");

                end;

            }


Here are the equivalent events called:

    trigger OnAfterGetCurrRecord()
    begin
        CurrPage.Lines.Page.InitTempTable(xrec."Order Reference", xrec."Landed Cost Template");
    end;

    trigger OnOpenPage()
    begin
        CurrPage.Lines.Page.InitTempTable(xrec."Order Reference", xrec."Landed Cost Template");
    end;

    trigger OnAfterGetRecord()
    begin
        CurrPage.Lines.Page.InitTempTable(xrec."Order Reference", xrec."Landed Cost Template");
    end;


Not one of the above events seems to execute the code automatically. The behaviour I want is that if you open a record, or move between records it will automatically populate the temporary table. I don't understand why it works form one context and not the other.

Categories:
I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Why are you using xRec and not Rec? Are you sure that xRec is not empty with these events?

  • Rufus Profile Picture
    on at

    Thanks Stefano. Prompted me to did deeper on google and discover all the vagaries of rec and xrec and the purpose. The actual formal documentation is rather light.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans