2

I am unable to retrieve picklist values from a User object field as the object doesn't have a record type (or master). Does anyone know if it's possible?

https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_wire_adapters_picklist_values

Ive tried without specifying a recordtypeid but no luck:-

    @wire(getObjectInfo, { objectApiName: USER_OBJECT })
userMetadata;

@wire(getPicklistValues, { recordTypeId: '$userMetadata.data.defaultRecordTypeId', fieldApiName: FIELD})
picklistValues;
1
  • Found any solution? @Pete
    – Rv1
    Commented Apr 26, 2023 at 7:28

1 Answer 1

1

The getPicklistValues wire is buggy. It only seems to work after setting a reactive variable within connectedCallback. You'll have to assign FIELD to a member variable within connectedCallback in order to get this to work.

@wire(getObjectInfo, { objectApiName: USER_OBJECT })
userMetadata;

@wire(getPicklistValues, { recordTypeId: '$userMetadata.data.defaultRecordTypeId', fieldApiName: '$myUserField'})
picklistValues;

connectedCallback() {
    this.myUserField = FIELD;
}
1
  • So that solution work fines for other objects like Account but as soon as I switch to the User object I get an error. I can only assume its because the User object doesn't have a record type?
    – Pete
    Commented Aug 13, 2021 at 8:29

You must log in to answer this question.

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