Created
May 27, 2019 13:43
-
-
Save sfmishra/144ef1ba3f6e62caa9071ba0e91c6468 to your computer and use it in GitHub Desktop.
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
import { LightningElement, api, wire, track } from 'lwc'; | |
import { getObjectInfo } from 'lightning/uiObjectInfoApi'; | |
import ACCOUNT_OBJECT from '@salesforce/schema/Account'; | |
import ACCOUNT_NAME from '@salesforce/schema/Account.Name'; | |
import INDUSTRY_NAME from '@salesforce/schema/Account.Industry'; | |
import PHONE_VALUE from '@salesforce/schema/Account.Phone'; | |
export default class RecordFormWithRecordTypes extends LightningElement { | |
@api recordId; | |
@api objectApiName; | |
@track objectInfo; | |
fields=[ACCOUNT_NAME, INDUSTRY_NAME, PHONE_VALUE]; | |
@wire(getObjectInfo, {objectApiName: ACCOUNT_OBJECT}) | |
objectInfo; | |
get recordTypeId() { | |
const rtis = this.objectInfo.data.recordTypeInfos; | |
console.log(' ##### ' + JSON.stringify(rtis)); | |
console.log(' ##2### ' + Object.keys(rtis).find(rti => rtis[rti].name === 'Partner')); | |
return Object.keys(rtis).find(rti => rtis[rti].name === 'Partner'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment