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

selected lines

(1) ShareShare
ReportReport
Posted on by 59
need to send an email only to the records that the user selects in a list page. What is the recommended way to capture the selected lines in a page so I can loop through them and pass the data (e.g., email addresses) into my mail-sending function?
I have the same question (0)
  • Suggested answer
    Sumit Singh Profile Picture
    4,821 on at
    selected lines
    Hi,

    Use CurrPage.SetSelectionFilter on an action. It captures only the user‑selected rows into a record variable (same table), which you can loop and pass to your mail function.
    actions
    {
        action(SendEmails)
        {
            Caption = 'Send Emails';
            Image = Email;
            ApplicationArea = All;
            Promoted = true; PromotedCategory = Process;

            trigger OnAction()
            var
                Sel: Record "Customer"; // use your page's source table
            begin
                CurrPage.SetSelectionFilter(Sel);
                if Sel.IsEmpty() then
                    Error('Select at least one row.');

                if Sel.FindSet() then
                    repeat
                        if Sel."E-Mail" <> '' then
                            SendCustomerMail(Sel."No.", Sel."E-Mail"); // your function
                    until Sel.Next() = 0;
            end;
        }
    }
    Notes
    • Ensure the list page allows multi‑select (default is allowed on List pages).
    • If you want to process elsewhere, pass Sel (with its selection filter) or copy keys to a temp table/list.
    Response created with the help of Co-Pilot. Please mark “Verified” if it helps.
  • Suggested answer
    Sahan Hasitha Profile Picture
    1,690 on at
    selected lines
    hi
    use CurrPage.SetSelectionFilter this and use loop

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 3,152

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,944

#3
Sohail Ahmed Profile Picture

Sohail Ahmed 2,444 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans