You need to sign in to do that
Don't have an account?
chikku
Used getRecord method it throws error on console ,any resolved solution?
This my code i used(anything i need to modify,please let me know).
this cause error:
import { LightningElement, track, api,wire } from 'lwc'; import { getRecord,getFieldValue } from 'lightning/uiRecordApi'; @track recType; @api recordId; @track LjobsValue; @track CjobsValue; @track MjobsValue; @wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] }) wiredRecord({data,error}) { if (data) { var result = JSON.parse(JSON.stringify(data)); this.recType=result.recordTypeId; this.LjobsValue=getFieldValue(data,'Loan__c.Total_Jobs_Lost__c'); this.MjobsValue=getFieldValue(data,'Loan__c.Total_Jobs_Maintained__c'); this.CjobsValue=getFieldValue(data,'Loan__c.Total_Jobs_Created__c'); } else{ this.error=error; console.log(error); } } i used this code it throws error in console
this cause error:
Then the lookup relationship field (Account__r) is not valid. You have to find out what is the field name in loan__c object setting.
You can try the following soql in developer console, and I think it will tell you such field not exist.
select id,account__r.name from loan__c
All Answers
1. If Loan__c object has record type. if not, line 12 will err out.
2. Make sure Total_Jobs_Lost__c,Total_Jobs_Maintained__c,and Total_Jobs_Created__c are valid field on Loan__c object.
this.recType=data.recordTypeId;
Then the lookup relationship field (Account__r) is not valid. You have to find out what is the field name in loan__c object setting.
You can try the following soql in developer console, and I think it will tell you such field not exist.
select id,account__r.name from loan__c