Hi
I have added Button on a Form . On click i want to insert a record in another table from that form.
Thanks
*This post is locked for comments
Hi
I have added Button on a Form . On click i want to insert a record in another table from that form.
Thanks
*This post is locked for comments
Yes, correct. Check that the record in the second table doesn't exists and then perform the INSERT of the new record.
Hi
Thanks . Secondly i first want to check that Document No should not already exists in that table . If not exists Then it should insert
Thanks
I suppose you was using NAV 2013 (this is what is written under your first post). However, for NAV 2009 (Form) you need to create the code under the OnPush event of your button.
Hi
Code is to be written onPush() of Command Button or somewhere other trigger . I am using 2009
Thanks
The record in your page is Rec. In the OnAction trigger you've to create the new record in the second table passing the values from Rec that you need. I don't know your requirements but you can write something like:
//Check if the record in the second table already exists. If not exists, create the record
If NOT MySecondTable.GET(...) then
BEGIN
MySecondTable.Field1 := Rec.Field1;
MysecondTable.Field2 := Rec.Field4; //Assign the value you want
MySecondTable.INSERT;
END;
Hi
Can u provide sample . I want to write the code in OnAction. I want information from Page to another Custom Table
Thanks
Are you talking about Pages I suppose. In the OnAction of your added button (action), you've to write the code you want (or better, call a function defined in a codeunit that does the work of inserting the record in the other table).
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,387
Most Valuable Professional
nmaenpaa
101,156