– Common Function Library Project


Last updated September 25, 2012


Bilal Soylu

Version: 1 | Requires: CF9 | Library: DatabaseLib

The function can be used within code to determine whether one is currently within a CFTRANSACTION or not. Credit for the technique must go to Bilal from who wrote this article from which I lifted the concept: All I have done is turned it into a UDF. This calls an internal ColdFusion Java class, so will not work on Railo or OpenBD. It has been tested to work on CFMX7, CF9 and CF10 (I have not tested on CF8 as I don't have a CF8 server to test with, but see no reason why it would not work on CF8 if it works on the version either side of it.

Return Values:
Returns true if the call was within a CFTRANSACTION, otherwise false.


Before: #isInTransaction()#<br />
    Within: #isInTransaction()#<br />
After: #isInTransaction()#<br />


No arguments.

Full UDF Source:

 * Returns true if the call to it is within a CFTRANSACTION block
 * v0.1 by Bilal Soylu
 * v1.0 by Adam Cameron: simplifying logic &amp; converting to script
 * v1.1 by Adam Cameron: fixed bug causing potential false positives (as advised by Bilal)
 * @return Returns true if the call was within a CFTRANSACTION, otherwise false. 
 * @author Bilal Soylu ( 
 * @version 1.1, September 24, 2012 
function isInTransaction(){
    var result = createObject("java", "coldfusion.tagext.sql.TransactionTag").getCurrent();
    return structKeyExists(local, "result");


Latest Additions

Raymond Camden added
November 04, 2017

Leigh added
May 11, 2016

Raymond Camden added
May 10, 2016

Kevin Cotton added
May 05, 2016

Raymond Camden added
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson