How to use Currform.EDITABLE

Christian_WandborgChristian_Wandborg Member Posts: 23
Hi,

I use the following code in Sales Orders to run the form 'Comment Sheet' when adding sales lines, to popup the form 'Comment Sheet' if any commet exists:

IF (CurrFieldNo = FIELDNO("No.")) AND ("Document Type" = "Document Type"::Order) THEN BEGIN
CLEAR(CommentLine);
CommentLine.SETRANGE("Table Name",CommentLine."Table Name"::Item);
CommentLine.SETRANGE("No.","No.");
IF CommentLine.FIND('-') THEN
FORM.RUN(FORM::"Comment Sheet",CommentLine);
END;

Now, I want the form NOT to be editable ONLY when called from sales lines.

Any suggestions?
Regards
Christian

Answers

  • klavinklavin Member Posts: 117
    You would have to declare a variable for the form, and create a function in the form to set the form to editable(FALSE) beforehand.

    FormVariable.SETTABLEVIEW(CommentLine);
    FormVariable.EDITABLE(FALSE);
    FormVariable.RUNMODAL();
    -Lavin
    "Profanity is the one language all programmers know best."
  • Christian_WandborgChristian_Wandborg Member Posts: 23
    I’ve created the function ’AnyComments’ to be called from the ’No. - OnValidate()’ trigger on table 37. The code looks like this:

    No. - OnValidate()

    IF (CurrFieldNo = FIELDNO("No.")) AND ("Document Type" = "Document Type"::Order) THEN BEGIN
    Any Comments();
    END;


    AnyComments()

    CLEAR(CommentLine);
    CommentLine.SETRANGE("Table Name",CommentLine."Table Name"::Item);
    CommentLine.SETRANGE("No.","No.");
    CommentSheet.SETTABLEVIEW(CommentLine);
    CommentSheet.EDITABLE(FALSE);
    CommentSheet.RUN();

    …but the form ’Comment Sheet’ still pops up editable... ](*,)
    Regards
    Christian
  • kapamaroukapamarou Member Posts: 1,152
    Is there any code on the CommentLine form that changes the editable state?
  • Christian_WandborgChristian_Wandborg Member Posts: 23
    Thanks guys, after some adjustments it runs smooth :thumbsup:
    Regards
    Christian
Sign In or Register to comment.