Skip to content

Commit 4f7eaca

Browse files
fix: custom labels are data raptor issues
1 parent 0163f52 commit 4f7eaca

File tree

5 files changed

+723
-8
lines changed

5 files changed

+723
-8
lines changed

messages/assess.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"allVersionsDescription": "Migrate all versions of a component",
3030
"changeMessage": "The %s %s will be changed from %s to %s",
3131
"angularOSWarning": "We couldn't migrate Angular Omniscripts. Convert all Angular Omniscripts to LWC Omniscripts, and try again.",
32+
"customLabelMigrationErrorMessage": "We couldn’t complete the Custom Labels migration. Check your org configuration and confirm it meets the requirements outlined <a href='https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_oma_prereq.htm&type=5' target='_blank'>here</a>.",
3233
"relatedObjectGA": "Select the component type that you want to migrate: 'apex' for Apex classes, 'lwc' for Lightning Web Components, 'flexipage' for FlexiPages, 'expsites' for Experience Sites, or 'apex, lwc, flexipage, expsites' if you want to include all types.",
3334
"noPackageInstalled": "No valid package found in your org.",
3435
"alreadyStandardModel": "Your org already uses the standard data model.",

src/migration/dataraptor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
177177
const transformedDataRaptor = this.mapDataRaptorRecord(dr);
178178

179179
// Verify duplicated names before trying to submitt
180-
if (duplicatedNames.has(transformedDataRaptor['Name'])) {
180+
if (duplicatedNames.has(transformedDataRaptor['Name'].toLowerCase())) {
181181
this.setRecordErrors(dr, this.messages.getMessage('duplicatedDrName', [transformedDataRaptor['Name']]));
182182
originalDrRecords.set(recordId, dr);
183183
continue;
@@ -226,7 +226,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
226226
if (drUploadResponse && drUploadResponse.success === true) {
227227
// Append the processed DM name into duplicateNames Map
228228
const dataMapperName = transformedDataRaptor[DRBundleMappings.Name];
229-
duplicatedNames.add(dataMapperName);
229+
duplicatedNames.add(dataMapperName.toLowerCase());
230230

231231
const items = await this.getItemsForDataRaptor(dataRaptorItemsData, name, drUploadResponse.id);
232232
drUploadResponse.newName = dataMapperName;
@@ -398,11 +398,11 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
398398
assessmentStatus = 'Needs manual intervention';
399399
}
400400

401-
if (existingDataRaptorNames.has(existingDRNameVal.cleanName())) {
401+
if (existingDataRaptorNames.has(existingDRNameVal.cleanName().toLowerCase())) {
402402
warnings.push(this.messages.getMessage('duplicatedName') + ' ' + existingDRNameVal.cleanName());
403403
assessmentStatus = 'Needs manual intervention';
404404
} else {
405-
existingDataRaptorNames.add(existingDRNameVal.cleanName());
405+
existingDataRaptorNames.add(existingDRNameVal.cleanName().toLowerCase());
406406
}
407407
const apexDependencies = [];
408408
if (dataRaptor[this.getBundleFieldKey('CustomInputClass__c')]) {

src/utils/customLabels.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export class CustomLabelsUtil {
5656
const name = label.Name;
5757
const value = label.Value;
5858
const id = label.Id;
59-
60-
const externalString = externalStrings.find((es) => es.Name === name);
59+
const externalString = externalStrings.find((es) => es.Name.toLowerCase() === name.toLowerCase());
6160
let assessmentStatus = 'Ready for migration';
6261
let summary = '';
6362

test/migration/dataraptor-usecase2-standard-datamodel.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe('DataRaptor Standard Data Model (Metadata API Disabled) - Assessment an
154154
});
155155

156156
it('should detect duplicate DataRaptor names and require manual intervention', async () => {
157-
const existingNames = new Set(['CustomerDataLoader']);
157+
const existingNames = new Set(['customerdataloader']); // Use lowercase to match the actual implementation
158158
const mockDataRaptor = {
159159
Id: 'dr4',
160160
Name: 'Customer-Data@Loader!', // This will clean to CustomerDataLoader (duplicate)
@@ -168,8 +168,9 @@ describe('DataRaptor Standard Data Model (Metadata API Disabled) - Assessment an
168168
const result = await (dataRaptorTool as any).processDataMappers(mockDataRaptor, existingNames, new Map(), []);
169169

170170
// Should require manual intervention for duplicated names
171+
// Note: When there's both a name cleaning warning AND a duplicate, 'Needs manual intervention' takes precedence
171172
expect(result.migrationStatus).to.equal('Needs manual intervention');
172-
expect(result.warnings).to.have.length.greaterThan(0);
173+
expect(result.warnings).to.have.length.greaterThan(1); // Should have both name change warning and duplicate warning
173174
expect(result.warnings.some((warning) => warning.includes('Duplicated'))).to.be.true;
174175
});
175176

0 commit comments

Comments
 (0)