isWithinTransaction

Determines whether the current code is running inside a cftransaction block. Returns true as soon as the block is entered, even before its first query runs.

isWithinTransaction() → returns boolean

Compatibility

Lucee:

Version 5.3.9+ Introduced in 5.3.9.4.

Examples
Sample code invoking the isWithinTransaction function

Outside the transaction block the function returns false, inside it returns true.

writeOutput(isWithinTransaction());
transaction {
	writeOutput(isWithinTransaction());
}

Expected Result: falsetrue

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub