Skip to main content



No record found.

Business Central forum

I would like to select two record from n number of record in Automated Test case

Posted on by 159
I have one action called 'Reject', when I click on it , the status will go to Reject , When I do the multi selection and Click on Reject It will rejects the all the selected Lines.
In page we used setselectionfilter to work.
But, When its comes to automated test case , how can I select the records, even If I do filter the first record is taking place, not the remaining records
On the Date filter there are two records, I would like to reject those two.
How can I do that. Please suggest your answers.
Thank you.
  • HeinKruger Profile Picture
    HeinKruger 40 on at
    I would like to select two record from n number of record in Automated Test case
    If its more than one record the standard is to use FindSet.
    You add your SetRange and SetFilters and then you use Findset,.
    Inside the FindSet you will Reject them one by one.

    Something like this:
     SalesLine.SetRange("Document Type", SalesLine."Document Type"::Order);
            SalesLine.SetRange("Document No.", SalesHeader."No.");
            SalesLine.SetRange(Type, SalesLine.Type::Item);
            SalesLine.SetFilter("Location Code", '<>%1', '');
            SalesLine.SetLoadFields("Document No.", "Line No.");
            if SalesLine.FindSet() then
                until SalesLine.Next() = 0;

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,513 Super User

Martin Dráb Profile Picture

Martin Dráb 225,862 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans