How to mark records automatically when opening a list page?

Hi experts,

I have made a new list page that shows some records in Business Central cloud.

I would like that when the page is shown, all the records are marked automatically.

Then the user can unmark some of them and press a button.

I know that the function "Mark(true)" can mark a record, but I cannot see it on the page.

How do I do that?

Answers

  • Developer101Developer101 Member Posts: 452
    Perhaps you might want to write a code on the open page trigger of the page and mark the record and filter on marked records. You will find the example of that code if you search.
    United Kingdom
  • MortenSteengaardMortenSteengaard Member Posts: 105
    Hi Developer101,

    Thank you for your reply. I have done as you suggested, but I cannot make it show on screen that the records are selected. In the open page trigger on the page, I have added this code:

    Rec.FindSet();

    repeat
    Rec.Mark(true);
    until Rec.Next() = 0;

    Rec.MarkedOnly(true);
    Rec.FindSet();

    (I only open the page, if there is at least one record to show.)

    I have made a solution, where I have added a new field (a boolean called "Marked") to the record. I set it on all the records, I show, and then the user can unmark, whatever he/she wants. This works fine, but of course I would prefer, if the user would select these records in exactly the same way as other records in Business Central. But it seems, that is not implemented by Microsoft (yet).
Sign In or Register to comment.