Retail Order LWC

Access the RE order data in the LWC layer using the orderExtensionUtils service component.

The orderExtensionUtils LWC exposes events and methods to get the order state and extract data from the order, and push new data to the order.

Here are all the available methods in the orderExtensionUtils service component. You can import these methods in your custom LWC.

Get the order data.

API Version: 59.0

Signature: getOrderData(recordId)

Example

Update the managed packaged Order sObject (Order__c) fields.

API Version: 59.0

Signature: updateOrderData(recordId, srcThisRef, fieldApiName, value)

Example

Get the order item data.

API Version: 59.0

Signature: getOrderItemData(recordId)

Example

Update the managed packaged Order Item sObject (Order_Item__c) fields.

API Version: 59.0

Signature: updateOrderItemData(recordId, srcThisRef, itemId, fieldApiName, value)

Example

Sets a custom state for the order that is saved. Using the custom state, you can set up additional data to be saved along the order data in the same transaction as the order. This custom state gets forwarded to the Apex class that handles order save customizations.

API Version: 59.0

Signature: setCustomState(recordId, customState)

Example

Check if the order is in the edit mode or read-only mode. Use this method to render custom LWC components in the read-only or edit mode.

API Version: 59.0

Signature: getIsOrderInEditMode()

Example

Listen for the order data changes. Register a callback method, which gets invoked when an order field changes.

API Version: 59.0

Signature: registerListenerForOrderDataUpdates(recordId, thisRef, callback)

Example

Validate the order data changes. Register a callback method, which gets invoked when an order field changes. The method returns an error message if any validation fails.

API Version: 59.0

Signature: registerOrderDataInlineValidator(recordId, thisRef, callback)

Example

Listen for the order item data changes. Register a callback method, which gets invoked whenever any order item field changes.

API Version: 59.0

Signature: registerListenerForOrderItemDataUpdates(recordId, thisRef, callback)

Example

Validate the order item data changes. Register a callback method, which gets invoked whenever any order item field changes. The method returns an error message if any validation fails.

API Version: 59.0

Signature: registerOrderItemDataInlineValidator(recordId, thisRef, callback)

Example

Register callbacks before adding items.

API Version: 59.0

Signature: registerBeforeAddItemActionHandler(recordId, thisRef, callback)

Example

Register a callback before the save action.

API Version: 59.0

Signature: registerBeforeSaveActionHandler(recordId, thisRef, callback)

Example

Register a callback for the edit action. Render the custom LWC component in the read-only or edit mode.

API Version: 59.0

Signature: registerListenerForEnablingOrDisablingEditMode(recordId, thisRef, callback)

Example

orderExtensionUtils Component Example

If your org has Lightning Web Security enabled, the runtimeNamespace property on the metadata file isn’t required.

Lightning web security is a feature that must be tested before enabling. LWC Security

When setting the runtimeNamespace property in the metadata file, your component can’t use modules from the @salesforce package (any import whose route starts with @salesforce).