Corrected error with finding field values
This commit is contained in:
1 parent
db80663afb
commit
097a52bbc1
1 file changed
+13
-4
@@ -50,7 +50,7 @@ export default class OpportunityCustomClone extends NavigationMixin(LightningEle
|
||||
@wire(ObtainChildRelationships)
|
||||
processChildRelationships({error, data}) {
|
||||
if(error) {
|
||||
window.console.log('There is an error obtaining Cild Relationships');
|
||||
window.console.log('There is an error obtaining Child Relationships');
|
||||
window.console.error(error);
|
||||
}
|
||||
|
||||
@@ -145,19 +145,28 @@ export default class OpportunityCustomClone extends NavigationMixin(LightningEle
|
||||
});
|
||||
}
|
||||
|
||||
get hasRecordInfoResponse(){
|
||||
return typeof(this.recordInfo)!=='undefined' && this.recordInfo !== null;
|
||||
}
|
||||
get hasFieldInfo(){
|
||||
return Array.isArray(this.displayedFields) && this.displayedFields.length > 0;
|
||||
}
|
||||
|
||||
get formFields(){
|
||||
var formFieldsToReturn = [];
|
||||
var fieldRequirementMap = this.requiredFieldMap;
|
||||
var fieldRequirementMap, formFieldsToReturn = [];
|
||||
if(this.hasRecordInfoResponse && this.hasFieldInfo){
|
||||
fieldRequirementMap = this.requiredFieldMap;
|
||||
if(this.opportunityFields && this.displayedFields && this.recordInfo) {
|
||||
this.displayedFields.forEach(fieldName => {
|
||||
let fieldItem = fieldRequirementMap[fieldName];
|
||||
let fieldDisplay = JSON.parse(JSON.stringify(this.opportunityFields[fieldName]));
|
||||
if(!fieldItem){
|
||||
if(!fieldItem && typeof(this.recordInfo[fieldName])!=='undefined'){
|
||||
fieldDisplay.value = this.recordInfo[fieldName].value;
|
||||
}
|
||||
formFieldsToReturn.push(fieldDisplay);
|
||||
});
|
||||
}
|
||||
}
|
||||
return formFieldsToReturn;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user