Record filtration in OnOpenPage trigger

I want to show projects which have some specific permissions to the user which opening Projects list page.

I have written below code to calculate the permissions and store records in tempJob table.

what is the best way to apply those jobs from temporory variable to rec variable?


JobTMP.DELETEALL;
Job.RESET;
Job.SETFILTER(Blocked,'%1|%2',Job.Blocked::" ",Job.Blocked::Posting);
IF Job.FINDSET THEN
REPEAT
IF (Job."Person Responsible" = UserSetupRec."Resource Code") OR (Job."Project Manager" = UserSetupRec."Resource Code") THEN BEGIN
JobTMP := Job;
IF JobTMP.INSERT THEN
JobTMP.MODIFY;
END ELSE BEGIN

IF LimitProjectsandTasksLookup(UserSetupRec."Resource Code",Job."No.",'') THEN BEGIN
JobTMP := Job;
IF JobTMP.INSERT THEN
JobTMP.MODIFY;
END;

END;

UNTIL Job.NEXT = 0;

Related
Recommended