Options

add new value - not modify existing values

KarenKaren Member Posts: 79
I want to give the user the opportunity to add a new value when looking up the form but they may not have the opportunity to modify the existing values

if I set the following props:
Editable: True
InsertAllowed: True
ModifiedAllowed: FALSE
People still can change the existing values

if I set the following props:
Editable: FALSE
InsertAllowed: True
ModifiedAllowed: FALSE
People can't add a new values

Comments

  • Options
    krikikriki Member, Moderator Posts: 9,090
    In the "OnModifyRecord" of the form, put

    EXIT(FALSE);
    or
    ERROR('You cannot modify the record');

    the ERROR may be better because with that the user knows his action was refused.
    PS : the error should have a global constant, not the string like in my example.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    KarenKaren Member Posts: 79
    But I don't get the error when I put it in the onModifyRecord()
  • Options
    krikikriki Member, Moderator Posts: 9,090
    If you want an error, you must just put the ERROR-statement, not the EXIT(FALSE) statement. If you put the EXIT-statement, Navision will not process anything beyond the EXIT-statement.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    KarenKaren Member Posts: 79
    It only gives an error when I put it in the onRename() of my table

    But how can I replace the changed value back into the old (previous)
    value

    I tried to use:

    OnRename()
    VeldA := xRec.VeldA;
    Error('...');

    But in my table I can't do an update. Is that the reason why the value won't be replaced?
  • Options
    krikikriki Member, Moderator Posts: 9,090
    The only thing you have to do is to put some code in the form.

    Form - OnModifyRecord() : Boolean
    ERROR('You cannot modify the record');


    With this, you can insert, but not modify

    But you also need to put the property "DelayedInsert" to Yes. Otherwise when filled in the key-value, Navision Saves the record (=insert) and it is not possibile anymore to add a description.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.