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
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).
Can u provide sample . I want to write the code in OnAction. I want information from Page to another Custom Table
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;
Code is to be written onPush() of Command Button or somewhere other trigger . I am using 2009
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.
Thanks . Secondly i first want to check that Document No should not already exists in that table . If not exists Then it should insert
Yes, correct. Check that the record in the second table doesn't exists and then perform the INSERT of the new record.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Saurav.Dhyani 2 Super User 2025 Season 2
Alexander Ermakov 2
RK-25090803-0 1