AMT Help Files

Transaction Execution Hook

The transaction execution hook is an optional dll that can be used to manipulate or process the transaction and its data.
The hook is called twice, right before executing the transaction program, and after executing the transaction program.

To make use of the AMT Transaction Server Hook the location of the assembly must be specified in the AMT Control Center in the section 'runtime behaviour configuration'.

Creating a transaction execution hook

Transaction execution hooks are very customer specific and in most cases has been created by Avanade during the migration projects, however it is possible to create one yourself.

The created Transaction execution hooks must adhere to the following criteria:

The values of the transaction code and the members of the Transaction data object can be modified by the transaction hook.

If the result of TransactionProcessing method returns 'False', it means that the transaction hook did not execute successfully. At pre-processing this will result in sending the transaction data back to the client without any processing, while optionally an error message, if set in the transaction data object, will be displayed on the current form. If the failure occurs at post-processing, an empty "TerminalForm" will be send to the client while optionally displaying an error message.

On a successful execution of the Transaction hook, the TransactionProcessing method should return 'True'. Optional messages in the transaction data object will then be displayed on the next form that will be sent to the client.

 

An example of the mandatory sections:

/// <summary>

/// AMT Transaction Server Hook.

/// </summary>

public class TransactionHook {

    /// <summary>

    /// Called by the transactionserver before (and after) the execution of a transaction/program.

    /// </summary>

    /// <param name="trancode">Transaction Code</param>

    /// <param name="trandata">Transaction Data</param>

    /// <param name="post">True means post-processing, otherwise pre-processing</param>

    /// <returns>

    /// True means successful, the transactionserver can continue, otherwise a (error) message will be shown.

    /// False means an error has occurred, or a specific condition wasn't met; The transactionserver will stop processing the transaction.

    /// </returns>

    public Boolean TransactionProcessing (ref String trancode, AmtTransactionData trandata, Boolean post) {

       ...

       ...

       ...

    } // TransactionProcessing

  } // Class TransactionHook