Newer Version Available

This content describes an older version of this product. View Latest

Retail Order LWC

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

Namespace

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.

Supported Methods

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

getOrderData

Get the order data.

API Version
59.0
Signature
getOrderData(recordId)
Example

updateOrderData

Update the managed packaged Order sObject (Order__c) fields.

API Version
59.0
Signature
updateOrderData(recordId, srcThisRef, fieldApiName, value)
Example

getOrderItemData

Get the order item data.

API Version
59.0
Signature
getOrderItemData(recordId)
Example

updateOrderItemData

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

API Version
59.0
Signature
updateOrderItemData(recordId, srcThisRef, itemId, fieldApiName, value)
Example

setCustomState

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

getIsOrderInEditMode

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

registerListenerForOrderDataUpdates

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

registerOrderDataInlineValidator

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

registerListenerForOrderItemDataUpdates

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

registerOrderItemDataInlineValidator

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

registerBeforeAddItemActionHandler

Register callbacks before adding items.

API Version
59.0
Signature
registerBeforeAddItemActionHandler(recordId, thisRef, callback)
Example

registerBeforeSaveActionHandler

Register a callback before the save action.

API Version
59.0
Signature
registerBeforeSaveActionHandler(recordId, thisRef, callback)
Example

registerListenerForEnablingOrDisablingEditMode

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

Note

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).