Marks the end of a transaction.

ExampleTransaction Functions


lr.endTransaction( transactionName, status ) ;


transactionNameThe name of an existing transaction.
statusThe Transaction Status

The lr.endTransaction function marks the end of a transaction and records the amount of time it took to perform the transaction. To indicate a transaction to be analyzed, place the lr.startTransaction function before the transaction, and the lr.endTransaction function after the transaction.

If status is lr.AUTO, then the value of status is automatically assigned. By default, this value is lr.PASS signifying a successful transaction. However, if prior to lr.endTransaction, you change the default value using lr.setTransactionStatus or lr.failTransWithError, then this is the value which is passed as status in lr.endTransaction.

If you make a series of calls to functions that modify the lr.AUTO status, then it is the last call before lr.endTransaction which effectively changes the status.

Return Values

On success, returns 0. Returns -1 if the transaction name is illegal or if there is no prior call to lr.startTransaction with a transaction of the same name.


You cannot use standard parameterization for any arguments in this function.


function Action(){
    /* Notify that a transaction is starting */


   /* Server API call */

   rc = bank_deposit (50);

   /* End transaction with operation result */

   if (rc == 0)

       lr.endTransaction("deposit", lr.PASS);


       lr.endTransaction("deposit", lr.FAIL);
return 0;

See also: Example: Transactions