Labels

Wednesday, October 12, 2011

Convenient way to add new records by copying its parameters from template

I think it would be very convenient if we could use Data Templates when creating new record.
This way users shouldn't do fool mistakes on filling some mandatory fields like posting groups, location codes etc.

Let's take for example Item table.

There are several issues why we can't use Form - OnNewRecord and Form - OnInsertRecord triggers. In the first case we can't insert new record, because the transaction could not be started there. In the second case 2 records would be created, 1st record is copied from template and 2nd is inserted with empty fields in a standard way.

That's why I've created new menubutton with F3 shortcut on Customer Card. This button should intercept event of creating item (pressing F3 key). The code of trigger is below:



Let's see the result:
1. By pressing F3 key a new window with Template selection appears:

2. After it the new item card contains fields, filled with default values:


Thanks to kriki at mibuso, whose post helped me so much. Whole thread you can read here: http://mibuso.com/forum/viewtopic.php?f=23&t=42530

1 comment:

Dynamics NAV Enthusiast said...

So simple, yet genius! :)

I agree that templates should be used when entering data (for faster and more efficient way) and you trick with F3 is really brilliant.