Marking records in NAV tables
Let’s assume that you have exported some sales invoices from NAV and you want to make sure that you don’t export these records again. How could you assume that?
The most useful way of marking the records is to create one or more “status” fields to represent the EDI Export status. For example a boolean field that is set to “TRUE” upon export, or a timestamp field which is filled with the date and time of the export.
No matter which type and how many fields you create for this marking, you also need to create an EDI Callback Function that sets the appropriate values bceause EDI Connect normally doesn’t have access to tables with history data. In this case, you could create a new function in the codeunit “EDI Callback” with one parameter and pass the number of the posted sales invoice to the function, GET it in the code, change the field(s) and modify the record. If you have several tables that you want to mark, you either need a function for each table or add another parameter to the function and pass the document type or table to it.
When the marks are set, you can filter in your NAV mapping on these fields to determine which records haven’t been handled yet. In the example of the boolean field, the filter would look like “Transferred to EDI=CONST(FALSE)”, speaking in terms of NAV filter strings. But you will get the way how it is meant.
If you don’t want or cannot add fields to the tables, you could create a new table and store the primary keys of the records that have already been handled by the export NAV mappings. Instead of filtering the sales invoice table directly you’d need to insert a loop over this new table and try to find a record in this table for the invoice. If there are no records in the filter, then the further processing would be allowed and the key fields information is written to the new table.