Sending Transactions Extensibility

Using Web Replication and using Storage Queue

When sending transactions using Send Transactions Using Web Replication or Send Transaction by Storage Queue , new fields added to existing tables are included automatically.

To send additional tables together with the transaction, you need to subscribe to the OnAfterLoadTransactionTables event and add the table data to the buffer that is sent to Head Office (HO).

Example: Adding a custom table

Below is an example of how to add a custom table called Additional Trans. Info to the transaction data sent to Head Office. Assume this table is part of your own extension and stores extra information about each POS transaction. The table might contain the fields that identify a transaction (Store No., POS Terminal No. and Transaction No.), which allows you to filter on the records related to the transaction being sent. These fields are not mandatory or required to be part of the primary key, as long as you can relate the records in your table to the transaction in some way.

To include the new table you need to do two things:

  1. Subscribe to the OnAfterLoadTransactionTables event. It is published when the transaction data is collected for sending, and it gives you access to the transaction header being sent (TransactionHeaderTemp) and to the buffer that holds the data to be sent (BufferUtility).
  2. In the event subscriber, filter your custom table to the records that belong to the current transaction and load them into the buffer.

Step 1: Subscribe to the event

Subscribe to the following event in codeunit 99009519 LSC Web Request Data Mgt:

[IntegrationEvent(false, false)]
local procedure OnAfterLoadTransactionTables(var TransactionHeaderTemp: Record "LSC Transaction Header" temporary; var BufferUtility: Codeunit "LSC Buffer Utility")
begin
end;

Step 2: Add the table to the buffer

In the event subscriber, add the table to Buffer Utility. The following example adds the Additional Trans. Info table, filtering it on the transaction identifier fields:

//Additional Trans. Info
AddTransInfo.SETRANGE("Store No.", TransactionHeaderTemp."Store No.");
AddTransInfo.SETRANGE("POS Terminal No.", TransactionHeaderTemp."POS Terminal No.");
AddTransInfo.SETRANGE("Transaction No.", TransactionHeaderTemp."Transaction No.");
RecRef.GETTABLE(AddTransInfo);
WebRequestFunctions.LoadTableData(RecRef, BufferUtility);

The code first uses TransactionHeaderTemp to filter the new table, so that only the records belonging to the transaction being sent are included. It then gets a record reference to the filtered table and loads its data into BufferUtility. From there, the data is sent together with the rest of the transaction.

This works the same way whether transactions are sent through Web Replication or through Storage Queue.

Note: When the data is imported at HO, any extra fields that are not supported or do not exist at HO are ignored. This might happen if you're not using the same version of your custom extension on both POS and HO.