Skip to content

Commit

Permalink
Changes to populate batch-defaults with field-label instead of field-…
Browse files Browse the repository at this point in the history
…Api-Name

Populate Batch Defaults field of DataImportBatch with keys as field labels instead of field names.
  • Loading branch information
salesforce-suyash-more committed Sep 26, 2024
1 parent 3c48e20 commit 5f77083
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions force-app/main/default/lwc/geBatchWizard/geBatchWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ export default class geBatchWizard extends NavigationMixin(LightningElement) {
this.formSections.forEach(section => {
if (section.elements) {
section.elements.forEach(element => {
if (batchLevelDefaults[element.fieldApiName]) {
element.value = batchLevelDefaults[element.fieldApiName].value;
if (batchLevelDefaults[element.customLabel]) {
element.value = batchLevelDefaults[element.customLabel].value;
}
});
}
Expand Down Expand Up @@ -459,7 +459,7 @@ export default class geBatchWizard extends NavigationMixin(LightningElement) {
if (dataImportBatch.apiName === formElement.objectApiName) {
dataImportBatch.fields[formElement.fieldApiName] = formElement.value;
} else {
batchDefaults[formElement.fieldApiName] = {
batchDefaults[formElement.label] = {
objectApiName: formElement.objectApiName,
fieldApiName: formElement.fieldApiName,
value: formElement.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ export default class GeFormRenderer extends LightningElement{
sections.forEach(section => {
section.elements.forEach(element => {
for (let key in batchDefaultsObject) {
if (batchDefaultsObject.hasOwnProperty(key)) {
if (batchDefaultsObject.hasOwnProperty(key) && key === element.customLabel) {
const batchDefault = batchDefaultsObject[key];
if (batchDefault.objectApiName === element.objectApiName &&
batchDefault.fieldApiName === element.fieldApiName) {
Expand Down
3 changes: 2 additions & 1 deletion force-app/main/default/lwc/utilInput/utilInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export default class utilInput extends LightningElement {
return {
objectApiName: this.objectApiName,
fieldApiName: this.fieldApiName,
value: this.fieldValue
value: this.fieldValue,
label: this.uiLabel
};
}

Expand Down

0 comments on commit 5f77083

Please sign in to comment.