Created
July 31, 2020 11:36
Revisions
-
andrii-solokh created this gist
Jul 31, 2020 .There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ import { wire, api } from 'lwc'; import { getObjectInfo } from 'lightning/uiObjectInfoApi'; import LightningRadioGroup from 'lightning/radioGroup' export default class RecordTypeSelector extends LightningRadioGroup { @api objectApiName @wire(getObjectInfo, { objectApiName: '$objectApiName' }) wireOptions ({error, data}) { if(data) { let optionsValues = []; let rtValues = Object.values(data.recordTypeInfos); Array.from(rtValues).forEach((value, i) => { if(value.name !== 'Master') { optionsValues.push({ label: rtValues[i].name, value: rtValues[i].recordTypeId }) } }) this.options = optionsValues } else if(error) { window.console.log(JSON.stringify(error)); } } renderedCallback() { this.addEventListener('change', this.handleChange) } handleChange(event) { this.value = event.target.value } }