Target: Spring '26 (API 66.0). Sources: Component Configuration File, Configuration tags reference, Flow screen target.
The JavaScript is in the skill body (§2). This file has the other two files and the variants.
1. orderSummary.html
<template>
<lightning-card title={title} icon-name="standard:orders">
<div class="slds-var-p-horizontal_medium">
<template lwc:if={order}>
<dl class="slds-dl_horizontal">
<dt class="slds-dl_horizontal__label">Status</dt>
<dd class="slds-dl_horizontal__detail">{status}</dd>
</dl>
<lightning-button
label="Approve"
variant="brand"
disabled={notApprovable}
onclick={handleApprove}></lightning-button>
</template>
<template lwc:elseif={error}>
<div class="slds-text-color_error" role="alert">{message}</div>
</template>
<template lwc:else>
<lightning-spinner alternative-text="Loading order" size="small"></lightning-spinner>
</template>
</div>
</lightning-card>
</template>
Note the getter naming: templates cannot negate, so the JavaScript exposes notApprovable rather than the markup trying to write !approvable.
2. orderSummary.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>66.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Order Summary</masterLabel>
<description>Shows an order's status and lets an approver approve it.</description>
<targets>
<target>lightning__RecordPage</target>
<target>lightningCommunity__Page</target>
<target>lightningCommunity__Default</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__RecordPage">
<property name="title" type="String" label="Card title" default="Order summary"/>
<objects>
<object>Order__c</object>
</objects>
</targetConfig>
<targetConfig targets="lightningCommunity__Default">
<property name="title" type="String" label="Card title" default="Order summary"/>
<property name="recordId" type="String" label="Order record Id"/>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
Rules this file encodes:
apiVersionis required to save changes back to the org; keep it on the current release rather than letting it drift.isExposedistrueonly because the component is meant for builders. A child component used only by its parent staysfalsewith no targets.lightningCommunity__Pageputs the component in the Experience Builder palette;lightningCommunity__Defaultis what makes its properties editable there. Declaring only__Pagegives admins a component they cannot configure.<objects>on the record-page config limits where App Builder offers the component.- Every target used here exists in the documented list. There is no
lightning__ServiceCloud.
3. The Apex controller it calls
public with sharing class OrderController {
@AuraEnabled(cacheable=true)
public static List<Order__c> getOpenOrders(Id accountId) {
return [
SELECT Id, Name, Status__c, Total__c
FROM Order__c
WHERE Account__c = :accountId AND Status__c != 'Closed'
WITH USER_MODE
ORDER BY CreatedDate DESC
LIMIT 200
];
}
@AuraEnabled
public static void approveOrder(Id orderId) {
try {
OrderService.approve(new Set<Id>{ orderId }); // bulk-safe service, USER_MODE inside
} catch (Exception e) {
IntegrationLogger.error('OrderController.approveOrder', e);
throw new AuraHandledException('This order could not be approved. Reference ' + IntegrationLogger.lastRef());
}
}
}
cacheable=true on the read (so it can be wired, and it must contain no DML), plain @AuraEnabled on the mutation, WITH USER_MODE on the query, a real exception logged and a safe message returned.
4. Flow screen variant
import { LightningElement, api } from 'lwc';
import { FlowAttributeChangeEvent, FlowNavigationNextEvent } from 'lightning/flowSupport';
export default class OrderPicker extends LightningElement {
@api availableOrders; // input from the flow
@api selectedOrderId; // output back to the flow
handleSelect(event) {
this.selectedOrderId = event.detail.value;
this.dispatchEvent(new FlowAttributeChangeEvent('selectedOrderId', this.selectedOrderId));
}
handleNext() {
this.dispatchEvent(new FlowNavigationNextEvent());
}
@api
validate() {
return this.selectedOrderId
? { isValid: true }
: { isValid: false, errorMessage: 'Choose an order before continuing.' };
}
}
<targets>
<target>lightning__FlowScreen</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__FlowScreen">
<property name="availableOrders" type="@salesforce/schema/Order__c[]" label="Orders" role="inputOnly"/>
<property name="selectedOrderId" type="String" label="Selected order" role="outputOnly"/>
</targetConfig>
</targetConfigs>
validate() is what the flow calls when the user presses Next; returning isValid: false keeps them on the screen with the message.
5. LWR (Experience Cloud) notes
There is no
recordIdinjected on an LWR site page the way there is on a record page — pass it as a property or read it from the page reference.Navigation:
import { NavigationMixin } from 'lightning/navigation'; this[NavigationMixin.Navigate]({ type: 'comm__namedPage', attributes: { name: 'Order_Detail__c' }, state: { orderId: this.recordId } });comm__namedPagefor site pages,standard__recordPage/standard__objectPagewhere the site exposes records,standard__webPagefor external URLs.standard__appandstandard__navItemPageassume the internal app and do not work on a site.Guest users: what the component can read is decided by the site's guest user profile and sharing rules, not by the component. Test as a guest, not as yourself.
Public pages are indexed and measured: keep the initial payload small, avoid a wire that fans out into several Apex calls, and budget for Lighthouse rather than for the internal app's tolerance.