getPicklistValuesByRecordType

Use this wire adapter to get the values for every picklist of a specified record type.

Syntax 

1import { LightningElement, wire } from "lwc";
2import { getPicklistValuesByRecordType } from "lightning/uiObjectInfoApi";
3import ACCOUNT_OBJECT from "@salesforce/schema/Account";
4
5export default class Example extends LightningElement {
6  @wire(getPicklistValuesByRecordType, {
7    objectApiName: ACCOUNT_OBJECT,
8    recordTypeId: "012000000000000AAA",
9  })
10  propertyOrFunction;
11}

User Interface API Resource 

1GET /ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}

getPicklistValuesByRecordType uses this User Interface API resource.

Parameters 

Parameter NameTypeDescriptionRequired?
objectApiNameStringThe API name of a supported object.Yes
recordTypeIdStringThe ID of the record type. Use the Object Info defaultRecordTypeId property, which is returned from getObjectInfo.Yes

Read the data that’s returned by the wire adapter using a property or function.

propertyOrFunction—A private property or function that receives the stream of data from the wire service.

  • If a property is decorated with @wire, the results are returned to the property’s data property or error property.
  • If a function is decorated with @wire, the results are returned in an object with a data property and an error property.

Returns 

Usage 

Picklist values are scoped to a record type. getPicklistValuesByRecordType returns a collection of picklist values for all of the picklists of a specified record type. For more information, see Build UI for Picklists.

To retrieve picklist values for a specific field, use getPicklistValues instead.

The label property in each returned picklist value is translated into the running user’s language. For details, see Translate Picklist Labels.

Note

Example 

See the wireGetPicklistValuesByRecordType component in the lwc-recipes GitHub repo.

See Also

Release Preview

This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.