Last active
October 27, 2019 06:32
-
-
Save justin-lyon/241441fb2a4b0a9a78dbf4e0b83920f6 to your computer and use it in GitHub Desktop.
chain multiple wire adapters together to get picklist values dynamically by SObject and Field Name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@wire(getObjectInfo, { objectApiName: ACCOUNT_OBJECT }) | |
objectInfo; | |
@wire(getPicklistValues, { recordTypeId: '$objectInfo.defaultRecordTypeId', fieldApiName: 'Industry__c'}) | |
propertyOrFunction; | |
// *** WIP | |
import { LightningElement, wire } from 'lwc' | |
import { getObjectInfo, getPicklistValues } from 'lightning/uiObjectInfoApi' | |
import ACCOUNT from '@salesforce/schema/Account' | |
const MASTER_RT = '012000000000000AAA' | |
export default class MdtRecordtyper extends LightningElement { | |
@wire(getObjectInfo, { objectApiName: ACCOUNT }) | |
objectInfo | |
@wire(getPicklistValues, { recordTypeId: '$objectInfo.defaultRecordTypeId', fieldApiName: 'Type' }) | |
wiredPicklistValues ({ error, data }) { | |
console.log('account', ACCOUNT) | |
console.log('account info', this.objectInfo) | |
console.log('account default rt', this.objectInfo.defaultRecordTypeId) | |
if (error) { | |
console.error('Error getting picklistvalues', error) | |
return | |
} | |
console.log('picklistvalues', data) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment