γ°οΈLWC, Apex and Flows
In this article we will take a look at a more complex logging scenario involving an LWC component, a corresponding Apex controller, and an autolaunched Flow.
Implementation Approaches
Approach 1: Direct Parameter Passing
LWC Controller
// logDemoDirectParams.js
import apexActionThatTriggersFlow from '@salesforce/apex/LogDemoDirectController.apexActionThatTriggersFlow';
import Triton, { AREA, TYPE } from 'c/triton';
export default class LogDemoDirectParams extends LightningElement {
triton;
connectedCallback() {
// Bind triton to this component
this.triton = new Triton().bindToComponent('LogDemoDirectParams');
}
async executeScenario() {
// Create initial LWC log and get transaction ID
await this.triton.logNow(
this.triton.debug(TYPE.FRONTEND, AREA.ACCOUNTS)
.summary('Flow Demo - Start')
.details('Starting execution with direct parameter passing')
);
try {
// Pass transaction ID to Apex
await apexActionThatTriggersFlow({
transactionId: this.triton.transactionId
});
} catch (error) {
await this.triton.logNow(this.triton.exception(error));
}
}
}Apex Controller
Approach 2: Using Platform Cache
LWC Controller
Apex Controller
Transaction ID Flow
Apex Controller
The Flow
Flow Configuration

Choosing Between Approaches
Direct Parameter Passing
Platform Cache
The Result
Handling Flow Failures
Example of an Unhandled Flow Error
Resulting Log Structure
Benefits of Automatic Error Correlation
Last updated