Selected / Marked records

In an AL Extension CodeUnit, how do you iterate through the records that a user has selected / marked / ticked on a list page using the ‘Select More’ functionality? For instance, is there an IsMarked / IsSelected / IsTicked property in a data-type somewhere? Or, can you pass in the already drilled-down list to the codeunit?

One method would be currpage.setselectionfilter described here: https://docs.microsoft.com/en-us/dynamics-nav/setselectionfilter-function

you could then pass the record variable used for the selectionfilter into a codeunit for further processing. An example of it in action from standard BC:

action(CreateJobJournalLines)
{
ApplicationArea = Jobs;
Caption = ‘Create Job &Journal Lines’;
Image = PostOrder;
Promoted = true;
PromotedCategory = Process;
PromotedIsBig = true;
ToolTip = ‘Use a batch job to help you create sales journal lines for the involved job planning lines.’;

trigger OnAction()
var
JobPlanningLine: Record “Job Planning Line”;
JobJnlLine: Record “Job Journal Line”;
JobTransferLine: Codeunit “Job Transfer Line”;
JobTransferJobPlanningLine: Page “Job Transfer Job Planning Line”;
begin
if JobTransferJobPlanningLine.RunModal = ACTION::OK then begin
JobPlanningLine.Copy(Rec);
CurrPage.SetSelectionFilter(JobPlanningLine);

if JobPlanningLine.FindSet then
repeat
JobTransferLine.FromPlanningLineToJnlLine(
JobPlanningLine, JobTransferJobPlanningLine.GetPostingDate, JobTransferJobPlanningLine.GetJobJournalTemplateName,
JobTransferJobPlanningLine.GetJobJournalBatchName, JobJnlLine);
until JobPlanningLine.Next = 0;

CurrPage.Update(false);