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 update records in sub page from Header page in action

(0) ShareShare
ReportReport
Posted on by 100

hi

I want update few selected lines in sub page from Header (main page) from action area.

as per the forum suggestion I have created function as global  with paremeter as shown below

[External] CallLinesfromCard(krishna : Record "Sales Line")


CurrPage.SETSELECTIONFILTER(krishna);

PSaleslines:=krishna;

MESSAGE('Psaleslines '+FORMAT(krishna.COUNT));

On main page in Action button 'Start'  have created code as hwon below

Start - OnAction()

CurrPage.SalesLines.PAGE.CallLinesfromCard(lSalesLine);

//MESSAGE(FORMAT(lSalesLine.COUNT));
IF lSalesLine.FINDSET THEN
BEGIN
REPEAT
lSalesLine."Starting Time":=TIME;
lSalesLine."Salon action":=lSalesLine."Salon action"::Start;
lSalesLine.MODIFY;

UNTIL lSalesLine.NEXT = 0;

END;
CurrPage.UPDATE;

when I see the result at sub page , i can see selected records  but in action page I am not getting same records. Instead whole table records are getting update.

Can help me please

Kris

I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Do you want the action on the Header page or on the Subform page, you can also have the action on the Subform,

  • KrisMuthy Profile Picture
    100 on at

    hi 

    thank you

    you can see the above the action is in header only

    this in header page

    Start - OnAction()

    CurrPage.SalesLines.PAGE.CallLinesfromCard(lSalesLine);

    //MESSAGE(FORMAT(lSalesLine.COUNT));
    IF lSalesLine.FINDSET THEN
    BEGIN
    REPEAT
    lSalesLine."Starting Time":=TIME;
    lSalesLine."Salon action":=lSalesLine."Salon action"::Start;
    lSalesLine.MODIFY;

    this is in sub page

    CurrPage.SETSELECTIONFILTER(krishna);

    PSaleslines:=krishna;

    MESSAGE('Psaleslines '+FORMAT(krishna.COUNT));

     

    Something is missing.  may be variable or parameter

    please help

    warm regards

    kris

  • Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    You are on the header are you are trying to access the subpage selection, I don't believe you can do that. Why don't you add the action on the subform?

  • KrisMuthy Profile Picture
    100 on at

    yes it is possible

    my techi has done, now he is not accessble

    you can check the following

    www.cloudfronts.com/.../

    community.dynamics.com/.../getting-the-specific-record-of-the-line-items

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Krish,

    The solution they suggested is to create a function in the subform page, to retrieve the selected records and then call that function from page 42. You cannot directly access the selection of the subform page selected records.

    Can you show the function you have in subform page, how are you passing the variable?

  • KrisMuthy Profile Picture
    100 on at

    Yes Suresh,

    I want the selected records only should updated. one or two.  Thats all,

    as you said to create action button on sub-page, this is not visible

    Warm Regards

    Kris

  • KrisMuthy Profile Picture
    100 on at

    ONE

    ---------------------------

    [External] CallLinesfromCard(krishna : Record "Sales Line")

    CurrPage.SETSELECTIONFILTER(krishna);

    PSaleslines:=krishna;

    MESSAGE('Psaleslines '+FORMAT(krishna.COUNT));

    TWO

    --------------------------------

    [External] CallLinesfromCard1(CrateLinesTable : Record "Sales Line")

    CrateLinesTable:=Rec;

    CurrPage.SETSELECTIONFILTER(CrateLinesTable);

    MESSAGE('Sub page '+FORMAT(CrateLinesTable.COUNT));

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Kris,

    I think what you missing is you need to the variable as VAR when you call the function in the subform to send the variable as reference

  • Suggested answer
    divyeshchitte Profile Picture
    968 on at

    I will suggest you create action on Subpage as Suresh already mentioned.

    This will resolve your purpose

  • KrisMuthy Profile Picture
    100 on at

    Done, 

    It  is simple.

    Just create action on header and send value to function in sub page.

    in sub page function based action value update lines

    CurrPage.SETSELECTIONFILTER(lSalesLine);

    IF lSalesLine.FINDSET THEN BEGIN

    REPEAT

    CASE Actiontype OF
    1 :
    BEGIN
    StatusColor:='StandardAccent';
    lSalesLine."Salon action":="Salon action"::Start;
    lSalesLine."Starting Time":=TIME;
    lSalesLine.MODIFY;
    END;
    2 :
    BEGIN
    StatusColor:='Favorable';
    lSalesLine."Salon action":="Salon action"::Complete;
    lSalesLine."Ending Time":=TIME;
    lSalesLine.MODIFY;
    END;
    3 :
    BEGIN
    StatusColor:='Ambiguous';
    lSalesLine."Salon action":="Salon action"::Paid;
    lSalesLine.MODIFY;
    END;
    ELSE
    END;

    UNTIL lSalesLine.NEXT = 0;
    END;

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,229

#2
Jainam M. Kothari Profile Picture

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

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans