security filter give me this error why

ahmedbaahmedba Member Posts: 424
when i make post in purchase order debugger as link http://www.mediafire.com/?b9h7e1gwqbgxgzv
it give me this error
IF PurchaseLines.FIND('-') THEN BEGIN
REPEAT
(yellow cursor) IF PurchaseLines."Prepmt. Amt. Inv." <> PurchaseLines."Prepmt. Line Amount" THEN
EXIT(TRUE);
UNTIL PurchaseLines.NEXT = 0;
END;
and message told me "you dont have permission to read purchase line table"
how i solve this proplem

Comments

  • kinekine Member Posts: 12,562
    It only shows wrong line. The error is on the last line, where is the .NEXT. It is trying to get entry which is out of security filters. You need to apply the security filters to the record variable to prevent the NEXT from reading records to which the user do not have permissions.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ahmedbaahmedba Member Posts: 424
    Please Can you Clear your answer if think you are true but please send me detailes if possible
    please help me
  • kinekine Member Posts: 12,562
    What is not clear? You are using security filters. You are iterating through some records. The .NEXT command is trying to get record which is outside the security filters, because filters applied on the PurchaseLines variable are "wider" than the security filters. You need to limit the filters to same records which are inside the security filters by applying the security filters to the variable by SETPERMISSIONFILTER command. Of course, you must be sure what you are doing and what all this means. If you do not know, than there is another problem... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ahmedbaahmedba Member Posts: 424
    Ok i m sorry to say no clear but i request more detailes no more. Now what i understand is code will be as following:
    IF PurchaseLines.FIND('-') THEN BEGIN
    REPEAT
    IF PurchaseLines."Prepmt. Amt. Inv." <> PurchaseLines."Prepmt. Line Amount" THEN
    EXIT(TRUE);
    PurchaseLines.SETPERMISSIONFILTER;
    UNTIL PurchaseLines.NEXT = 0;
    END;
  • kinekine Member Posts: 12,562
    No, you need to set the filters before you start iterating the records, not inside the loop. One question: are you a developer? Are you working for end-user or partner?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ahmedbaahmedba Member Posts: 424
    Yes developer but i don't know more about c/al so that i ask you.
    now i understand what you say i will test then i will told you about result.
    thanks
Sign In or Register to comment.