General Considerations
Considerations for Field Service Mobile App
Base Components Support
Modules Support
Wire Adapters Support
Entity Support
Metadata and Custom Metadata Types Support
Previous Versions
Lightning web component wire adapters and JavaScript functions are described in “lightning/ui*Api Wire Adapters and Functions” in the Lighting Web Components Developer Guide.
The following wire adapters and functions can be used.
Support Status
Offline Capability
| Wire Adapter | Status | Offline Capability | Comments |
|---|---|---|---|
lightning/uiRecordApi Read record data and default values. Create, update, delete, and refresh records. | |||
createRecord | Drafts-Enabled | Mobile applications must have the object metadata to create records while offline. | |
createRecordInputFilteredByEditedFields | |||
deleteRecord | Drafts-Enabled | ||
generateRecordInputForCreate | |||
generateRecordInputForUpdate | |||
getFieldValue | |||
getFieldDisplayValue | |||
getRecord | Drafts-Enabled | getRecord supports two ways to specify which fields to load:
getRecord by layout isn’t supported. | |
getRecords | Drafts-Enabled | ||
getRecordCreateDefaults | Offline-Supported | ||
getRecordNotifyChange | |||
getRecordUi (deprecated) | See Wire Adapter Considerations. | ||
updateRecord | Drafts-Enabled | Mobile applications must have the object metadata to create records while offline. |
| Wire Adapter | Status | Offline Capability | Comments |
|---|---|---|---|
lightning/uiObjectInfoApi Get object metadata, and get picklist values. | |||
getObjectInfo | Offline-Supported | ||
getObjectInfos | Offline-Supported | ||
getPicklistValues | Offline-Supported | ||
getPicklistValuesByRecordType | Offline-Supported |
| Wire Adapter | Status | Offline Capability | Comments |
|---|---|---|---|
lightning/uiLayoutApi Get record layout metadata and data. | |||
getLayout | Offline-Supported |
| Wire Adapter | Status | Offline Capability | Comments |
|---|---|---|---|
lightning/uiAppsApi (beta) Get data and metadata for apps displayed in the Salesforce UI. | |||
getNavItems (beta) | Not yet supported due to beta status. |
| Wire Adapter | Status | Offline Capability | Comments |
|---|---|---|---|
lightning/uiListApi (deprecated) Get records and metadata for a list view. | |||
getListUi (deprecated) | See Wire Adapter Considerations. |
| Wire Adapter | Status | Offline Capability | Comments |
|---|---|---|---|
lightning/uiListsApi Get metadata for a list view. | |||
getListInfoByName | Offline-Supported | Use this adapter instead of lightning/uiListApi.getListUi. | |
getListInfosByName |
| Wire Adapter | Status | Offline Capability | Comments |
|---|---|---|---|
lightning/uiRelatedListApi Get records, metadata, and record count for a related list. | |||
getRelatedListRecords | Offline-Supported | getRelatedListRecords works while offline, but doesn’t update to add or remove records that are created or deleted while offline. | |
getRelatedListRecordsBatch | |||
getRelatedListInfo | Offline-Supported | ||
getRelatedListInfoBatch | Offline-Supported | ||
getRelatedListsInfo | Offline-Supported | ||
getRelatedListCount | Offline-Supported | getRelatedListCount works while offline, but doesn’t update to add or remove records that are created or deleted while offline. |
We describe getRecordUi and getListUi as having Limited Support. Both adapters are deprecated for all customers, and each has additional considerations for offline use. getRecordUi in particular has significant limitations. We would prefer to note both of these adapters as Not Supported, but each provides functionality that’s not easily replaced today. We recommend you carefully limit your use of these wire adapters.
Forward looking statement: Our goal is to provide supported alternatives to getRecordUi and getListUi. If you limit your usage of these adapters today, you’ll have an easier time migrating later.
Note
getRecordUi, limit yourself to getting layout metadata details, and use the data-only adapters getRecord and getRecords for data access.getListUi, use the new getListInfoByName wire adapter to get list view metadata. If you must use getListUi to access list view records, see the following considerations.Considerations for List Adapters
List- or collection-oriented adapters such as getListUi, getRelatedListRecords, and getRelatedListCount have limited support for offline updates. Specifically, list logic isn’t re-evaluated for changes made while you’re offline. That is, if you create or modify a record offline and it falls into or out of the list criteria, the record isn’t added or removed from the list until you’re back online. The list updates only after the changes sync back to Salesforce. This limitation affects list membership, but does not affect the display of records that are a part of a list.
Here’s an example to make this clear. Let’s say you use getRelatedListRecords as a source to display a list of records, and the related list criteria limits list membership to accounts whose name begins with “A”. While offline, if you update one of those records to change an account name to begin with a “B”, from “Apple” to “Banana”, that record will still display in the list, with the updated account name “Banana”. Once you return online, the change syncs to Salesforce, and the list criteria is reevaluated. The Banana account will no longer be a member of the related list, and the wire adapter is updated, triggering a component refresh. The list of records returned by getRelatedListRecords won’t include the record for the Banana account, and it will disappear from the list displayed in your component’s user interface.
Considerations for getRecordUi
getRecordUi is affected by numerous issues when used while offline.
getRecordUi on a draft record that was created while offline returns an error.getRecordUi on that record can be inconsistent.getRecordUi on that record can be inconsistent or result in an error.In theory, if you’re able to limit changes to records while offline to the scalar (non-relationship, non-metadata affecting) fields of that record, then invoking getRecordUi on that record should work as documented. In practice this is challenging, and when you miss it results in inconsistent or incorrect behavior that can be hard to troubleshoot. If you must use it, exercise extreme caution.
getRecordUi is used in the implementations of the following Lightning base components, causing them to have similar limitations:
lightning-record-formlightning-record-edit-formlightning-record-view-formWhen handling errors returned by wire adapters there’s potentially an issue with the “shape” of the error response. In contexts outside LWC Offline, the response returns a single error object. However, when an LWC wire adapter receives an error running in an LWC Offline-enabled mobile app, the response is returned as an array of error objects—most often, an array containing just one error object.
To make your components compatible across environments, we recommend a small amount of defensive coding at the start of your error handling. Convert a non-array into an array to ensure that the error shape is consistent:
1let errors = ...; // errors from wire adapter
2if ( ! Array.isArray(errors) ) {
3 errors = [ errors ];
4}See Also