๐Ÿ”ท Core

bx-compat-cfml

Use this skill to migrate ColdFusion (Adobe CF) or Lucee CFML applications to BoxLang using the bx-compat-cfml module: zero-code migration, engine configuration, null handling differences, type coercion modes, server scope population, JSON parsing behavior, and identifying incompatibilities.

$ npx skills add ortus-boxlang/skills/boxlang-modules/bx-compat-cfml
$ coldbox ai skills install ortus-boxlang/skills/boxlang-modules/bx-compat-cfml
๐Ÿ”— https://skills.boxlang.io/skills/raw/ortus-boxlang/skills/boxlang-modules~bx-compat-cfml

bx-compat-cfml: CFML Compatibility Layer

BoxLang is the AI-native software productivity platform for building, modernizing and running applications, with developers and AI agents working together.

Installation

install-bx-module bx-compat-cfml
# CommandBox
box install bx-compat-cfml

Purpose

bx-compat-cfml enables near-zero-code migration of existing Adobe ColdFusion or Lucee CFML applications to BoxLang. It adjusts BoxLang's behavior to match your source engine's quirks around:

  • Null handling and empty-string coercion
  • Type coercion and comparison behavior
  • Server scope population
  • JSON parsing and serialization
  • Query null handling
  • Function return-value behavior
  • ColdFusion/Lucee-specific BIFs and component behaviors

Configuration (boxlang.json)

{
  "modules": {
    "compat-cfml": {
      "settings": {
        "engine": "lucee"
      }
    }
  }
}

Engine Options

ValueDescription
"lucee"Emulates Lucee CFML behavior
"adobe"Emulates Adobe ColdFusion behavior

Behavioral Differences Emulated

Null Handling

// Adobe CF: null is returned as empty string ""
// Lucee: null is returned as actual null value

// With engine: "adobe"
var result = queryExecute( "SELECT NULL AS val", {}, { returntype: "array" } )
result[1].val == ""      // true โ€” null-to-empty-string conversion

// With engine: "lucee" OR native BoxLang
result[1].val == null    // true โ€” null stays null

Type Coercion

// Adobe CF: stricter implicit numeric coercion
// engine: "adobe" emulates Adobe's behavior

// Numeric comparison with strings
"10" > "9"    // Adobe: false (numeric compare: 10 > 9 = true)
"10" > "9"    // Lucee: false (string compare: "1" < "9")

Server Scope

// engine: "adobe" populates server scope with Adobe CF-compatible values
// engine: "lucee"  populates server scope with Lucee CF-compatible values

server.ColdFusion.ProductName    // "ColdFusion" (adobe) or "Lucee" (lucee)
server.ColdFusion.ProductVersion // Engine-specific version string

JSON Parsing

// Adobe CF: integers parsed from JSON as Integer type
// Lucee: integers parsed as Double

// engine: "adobe"
var data = deserializeJSON( '{"count": 5}' )
isInteger( data.count )   // true

// engine: "lucee"
isDouble( data.count )    // true

Migration Workflow

Step 1: Install and Configure

install-bx-module bx-compat-cfml
{
  "modules": {
    "compat-cfml": {
      "settings": {
        "engine": "lucee"
      }
    }
  }
}

Step 2: Run Your Application

BoxLang directly runs .cfc and .cfm files โ€” no conversion needed. Start your application and observe which behaviors differ.

Step 3: Identify Remaining Issues

Typical remaining issues after enabling the compat module:

  • Custom CF tags (.cftag) that have no BoxLang equivalent
  • Rarely-used Adobe-specific BIFs not in compat layer
  • JDBC DataSource configuration differences

Step 4: Incremental BoxLang Migration

Once the app runs with compat, start converting files to native BoxLang:

file.cfc โ†’ file.bx        (ColdFusion component โ†’ BoxLang class)
file.cfm โ†’ file.bxm       (ColdFusion template โ†’ BoxLang template)

Remove the compat module once all files are converted and all tests pass.

Key Compatibility Notes

Adobe CF-Specific BIFs Provided

The compat module adds Adobe CF-compatible versions of BIFs that behave differently in native BoxLang:

  • isJSON() โ€” Adobe compatibility
  • serializeJSON() โ€” Preserves Adobe CF serialization quirks
  • queryNew() โ€” Column type handling
  • structNew("ordered") โ€” Ordered struct behavior
  • Application lifecycle method names (onSessionStart, onCFCRequest, etc.)

Lucee-Specific BIFs Provided

  • getApplicationMetadata() โ€” Lucee-style return format
  • Null-safe behavior for various BIFs

Common Pitfalls

  • โœ… Always specify the correct engine โ€” "lucee" and "adobe" have meaningfully different behaviors
  • โŒ This module covers ~95% of migration cases; some Adobe-only features (e.g., <cfgrid>, old forms) have no equivalent
  • โœ… Use this as a migration aid, not a permanent target โ€” aim to remove it once your code is converted to native BoxLang
  • โŒ Don't enable both engine: "lucee" and engine: "adobe" simultaneously โ€” choose the source engine
  • โœ… Check BoxLang compatibility docs at https://boxlang.ortusbooks.com for a full list of covered behaviors