Clear the form in C/AL Code to insert a new record

erikerik Member Posts: 10
edited 2003-06-27 in Navision Attain
Hello,

I want to insert a new record using a form and initialize some fields without storing the record into the database (some required fields on the form).

This is the C/AL code I used on the event OnPush:
INIT;
CLEAR( “No.”); // Clear primary key
INSERT;

After the button is pushed the record is stored into the database even when the property DelayedInsert is set to yes.

Can someone help me?

Thanks,
Erik

Comments

  • jhoekjhoek Member Posts: 216
    Use the OnNewRecord trigger on the form to initialize your new record without inserting it.
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
  • erikerik Member Posts: 10
    Thank you for your quick response,

    bud how must a fire this (onrewrecord) trigger so that the record is not stored into the database?
  • jhoekjhoek Member Posts: 216
    You could place filters on all the fields that you want to fill and set the form's PopulateAllFields property to Yes.
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
Sign In or Register to comment.