5

I have created a custom Picklist in PricebookEntry and trying to get the Picklist values in LWC. All the solutions I found needs to pass the RecordTypeId to get the list.

@wire(getPicklistValuesByRecordType, { objectApiName: PRICEBOOK_OBJECT, recordTypeId: '$objectInfo.data.defaultRecordTypeId'})
 pickListValues;

For PricebookEntry, I can't create a Record Type. How can I get the Picklist values without the RecordTypeId?

1 Answer 1

10

Use the "null" record type Id, "012000000000000AAA" as the record type Id.

@wire(getPicklistValues, { objectApiName: PRICEBOOK_OBJECT, recordTypeId: '012000000000000AAA'})

This is demonstrated in the documentation.

5
  • 4
    I love how they make absolutely no mention that this ID is a "null" record type in the linked documentation.
    – John Au
    Commented Jun 29, 2021 at 1:47
  • 3
    @JohnAu Indeed. 000000000000000AAA can also be used in most cases where a null Id is expected. 012 is the key prefix for Record Type, which is why it is the null Record Type Id, but you can also use, for example, 001000000000000AAA as a null Account Id.
    – sfdcfox
    Commented Jun 29, 2021 at 15:27
  • This is mind-blowing (and helpful). I would have had to write a bunch of js to decode picklist dependency from the validFor value without this info. Is there any documentation that talks about the existence of 'null' ids ?
    – Nagen Sahu
    Commented Jan 18, 2023 at 19:12
  • @NagenSahu Null Id appears in the documentation in some rare cases, but I don't think there's a specific document that calls out null Id or its use. For example, Filter Users by Role ID to find users without an assigned role states how you can filter for users without a role. It's kind of hard to find much documentation on it.
    – sfdcfox
    Commented Jan 18, 2023 at 21:59
  • I have been developing on the SF platform for almost 7 years and this is the first I have ever heard of this lol
    – zgc7009
    Commented Dec 1, 2023 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .