Share this page

# lr.getTransactionStatus

Returns the current status of a transaction.

Transaction Functions

## Syntax

    lr.getTransactionStatus( transactionName ) ;

## Arguments

Argument | Comments
--- | ---
transactionName | The name of the transaction.

lr.getTransactionStatus returns the current status of a transaction. lr.getTransactionStatus cannot be invoked after lr.endTransaction. Since lr.getTransactionStatus can only return the status of an open transaction, it cannot report the final transaction status.

This function can be useful when a transaction that is made up of a number of steps can fail at various points. By checking the status and terminating the Vuser, you can prevent unnecessary activity.

## Return Values

Returns the transaction status. See Transaction Status

On error, returns a negative number.

## Parameterization

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

## Example

Copy code

    function Action(){
       var status;
       lr.startTransaction("Flight");
       web.url(
        {
          name : 'kalimanjaro',
          url : 'http://kalimanjaro/',
          targetFrame : '',
          resource : 0,
          recContentType : 'text/html',
          referer : '',
          snapshot : 't1.inf',
          mode : 'HTML'
        }
      );
       if (lr.getTransactionStatus() == lr.FAIL) {
            /* web_url has failed the transaction. No point in continuing,
             * because future calls will probably fail too */
            lr.endTransaction("Flight", lr.FAIL);
            return;
       }
       /* Carry on ... */
       status = web.url(
        {
          name : 'kalimanjaro',
          url : 'http://kalimanjaro/main.htm',
          targetFrame : '',
          resource : 0,
          recContentType : 'text/html',
          referer : '',
          snapshot : 't1.inf',
          mode : 'HTML'
        }
      );
    return 0;
    }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: