Skip to content

Commit a417e54

Browse files
Fix: remove cleanning of global auto number (#349)
1 parent 3f73508 commit a417e54

File tree

6 files changed

+14
-44
lines changed

6 files changed

+14
-44
lines changed

messages/assess.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
"integrationProcedureNameChangeMessage": "Integration Procedure reference %s will be changed to %s during migration.",
103103
"integrationProcedureManualUpdateMessage": "Integration Procedure reference %s may need manual updates after migration.",
104104
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name %s after name cleaning. This may cause conflicts during migration",
105-
"globalAutoNumberNameChangeMessage": "GlobalAutoNumber name will be changed from %s to %s to follow API naming standards",
106105
"duplicateGlobalAutoNumberNameMessage": "Potential duplicate: Another Global Auto Number has the same name %s after name cleaning. This may cause conflicts during migration",
107106
"existingApexPrompt": "Do you have a sfdc project that already contains the APEX classes retrieved from your org? [y/n]",
108107
"enterExistingProjectPath": "Enter the path to the project folder that contains the retrieved APEX classes:",

messages/migrate.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@
144144
"startingPostMigrationCleanup": "Starting post-migration cleanup for Global Auto Number...",
145145
"postMigrationCleanupCompleted": "Post-migration cleanup completed successfully.",
146146
"errorDuringPostMigrationCleanup": "We’ve encountered an error during the post-migration cleanup. Try again later.",
147-
"globalAutoNumberNameChangeMessage": "Global Auto Number name has been modified to fit naming rules: %s",
148147
"duplicatedGlobalAutoNumberName": "Duplicated Global Auto Number name",
149148
"errorWhileUploadingGlobalAutoNumber": "An error occurred while uploading Global Auto Number: ",
150149
"startingGlobalAutoNumberAssessment": "Starting Global Auto Number assessment...",

src/migration/globalautonumber.ts

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,8 @@ export class GlobalAutoNumberMigrationTool extends BaseMigrationTool implements
238238
if (!uploadResult.success) {
239239
uploadResult.errors = Array.isArray(uploadResult.errors) ? uploadResult.errors : [uploadResult.errors];
240240
}
241-
242-
// Check for name changes
243241
uploadResult.warnings = uploadResult.warnings || [];
244-
if (transformedName !== autonumber['Name']) {
245-
uploadResult.newName = transformedName;
246-
uploadResult.warnings.unshift(
247-
this.messages.getMessage('globalAutoNumberNameChangeMessage', [transformedName])
248-
);
249-
}
250-
242+
uploadResult.newName = transformedName;
251243
globalAutoNumberUploadInfo.set(recordId, uploadResult);
252244
}
253245
} catch (err) {
@@ -333,23 +325,13 @@ export class GlobalAutoNumberMigrationTool extends BaseMigrationTool implements
333325
errors: [],
334326
};
335327

336-
// Check for name changes due to API naming requirements
337-
const originalName: string = globalAutoNumberName;
338-
const cleanedName: string = this.cleanName(originalName);
339-
if (cleanedName !== originalName) {
340-
globalAutoNumberAssessmentInfo.name = cleanedName;
341-
globalAutoNumberAssessmentInfo.warnings.push(
342-
this.messages.getMessage('globalAutoNumberNameChangeMessage', [originalName, cleanedName])
343-
);
344-
}
345-
346328
// Check for duplicate names
347-
if (uniqueNames.has(cleanedName)) {
329+
if (uniqueNames.has(globalAutoNumberName)) {
348330
globalAutoNumberAssessmentInfo.errors.push(
349-
this.messages.getMessage('duplicateGlobalAutoNumberNameMessage', [cleanedName])
331+
this.messages.getMessage('duplicateGlobalAutoNumberNameMessage', [globalAutoNumberName])
350332
);
351333
}
352-
uniqueNames.add(cleanedName);
334+
uniqueNames.add(globalAutoNumberName);
353335
return globalAutoNumberAssessmentInfo;
354336
}
355337

@@ -378,9 +360,6 @@ export class GlobalAutoNumberMigrationTool extends BaseMigrationTool implements
378360
}
379361
});
380362

381-
// Set essential default values (following same pattern as other entities)
382-
mappedObject['Name'] = this.cleanName(mappedObject['Name']);
383-
384363
// BATCH framework requires that each record has an "attributes" property
385364
mappedObject['attributes'] = {
386365
type: GlobalAutoNumberMigrationTool.OMNI_GLOBAL_AUTO_NUMBER_NAME,

src/utils/constants/documentRegistry.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@ export const documentRegistry = {
5252
dataRaptorNameChangeMessage:
5353
'https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_update_references_to_dataraptors_from_apex_after_migration.htm&type=5',
5454
integrationProcedureNameChangeMessage:
55-
'https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_update_references_to_integration_procedures_after_migration.htm&type=5',
55+
'https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_update_references_to_dataraptors_from_apex_after_migration.htm&type=5',
5656
integrationProcedureManualUpdateMessage:
57-
'https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_update_references_to_integration_procedures_after_migration.htm&type=5',
57+
'https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_update_references_to_dataraptors_from_apex_after_migration.htm&type=5',
5858
duplicateCardNameMessage: 'https://help.salesforce.com/s/articleView?id=xcloud.os_clone_a_flexcard.htm&type=5',
59-
globalAutoNumberNameChangeMessage:
60-
'https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_naming_conventions.htm&type=5',
6159
duplicateGlobalAutoNumberNameMessage:
6260
'https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_naming_conventions.htm&type=5',
6361
};

test/migration/globalautonumber.test.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ describe('GlobalAutoNumberMigrationTool', () => {
160160
expect(getMessageStub.called).to.be.true;
161161
});
162162

163-
it('should handle name changes in assessment', async () => {
163+
it('should preserve names with special characters in assessment', async () => {
164164
// Arrange
165165
const mockGlobalAutoNumbers = [
166166
{
167167
Id: '001',
168-
Name: 'Test-GAN-1', // Name with special characters
168+
Name: 'Test-GAN-1', // Name with special characters should be preserved
169169
Increment__c: 1,
170170
LastGeneratedNumber__c: 100,
171171
LeftPadDigit__c: 5,
@@ -178,17 +178,15 @@ describe('GlobalAutoNumberMigrationTool', () => {
178178
sandbox.stub(QueryTools, 'queryAll').resolves(mockGlobalAutoNumbers);
179179
getMessageStub.withArgs('startingGlobalAutoNumberAssessment').returns('Starting assessment...');
180180
getMessageStub.withArgs('foundGlobalAutoNumbersToAssess', [1]).returns('Found 1 Global Auto Number');
181-
getMessageStub
182-
.withArgs('globalAutoNumberNameChangeMessage', ['Test-GAN-1', 'TestGAN1'])
183-
.returns('Name will be changed');
184-
// No migration info message expected since it was removed
185181

186182
// Act
187183
const result = await globalAutoNumberMigrationTool.assess();
188184

189185
// Assert
190186
expect(result).to.be.an('array').with.length(1);
191-
expect(result[0].warnings).to.include('Name will be changed');
187+
expect(result[0].name).to.equal('Test-GAN-1'); // Name should be preserved
188+
expect(result[0].oldName).to.equal('Test-GAN-1');
189+
expect(result[0].warnings).to.be.empty; // No warnings since no name changes
192190
});
193191

194192
it('should handle errors during assessment', async () => {
@@ -416,9 +414,6 @@ describe('GlobalAutoNumberMigrationTool', () => {
416414
sandbox.stub(QueryTools, 'queryAll').resolves(mockGlobalAutoNumbers);
417415
getMessageStub.withArgs('startingGlobalAutoNumberAssessment').returns('Starting assessment...');
418416
getMessageStub.withArgs('foundGlobalAutoNumbersToAssess', [1]).returns('Found 1 Global Auto Number');
419-
getMessageStub
420-
.withArgs('globalAutoNumberNameChangeMessage', ['TestGAN1', 'TestGAN1'])
421-
.returns('Name will be changed');
422417
getMessageStub.withArgs('unexpectedError').returns('Unexpected error');
423418

424419
// Act
@@ -487,7 +482,7 @@ describe('GlobalAutoNumberMigrationTool', () => {
487482
// The method removes everything after the first __, so Increment__c becomes 'c'
488483
// This causes fields to not be mapped properly
489484
expect(result).to.deep.include({
490-
Name: 'TestGAN1', // Cleaned name
485+
Name: 'Test-GAN-1', // Name should be preserved with special characters
491486
attributes: {
492487
type: 'OmniGlobalAutoNumber',
493488
referenceId: '001',

test/utils/constants/documentRegistry.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ const titles = {
3636
omniScriptNameChangeMessage:
3737
'Update Omniscript Custom Lightning Web Components and Omniscript Elements Overridden with Customized Components',
3838
dataRaptorNameChangeMessage: 'Update References to Omnistudio Components After Migration',
39-
integrationProcedureNameChangeMessage: 'Update Integration Procedure Type and Subtype After Migration',
40-
integrationProcedureManualUpdateMessage: 'Update Integration Procedure Type and Subtype After Migration',
39+
integrationProcedureNameChangeMessage: 'Update References to Omnistudio Components After Migration',
40+
integrationProcedureManualUpdateMessage: 'Update References to Omnistudio Components After Migration',
4141
duplicateCardNameMessage: 'Clone a Flexcard',
4242
};
4343

0 commit comments

Comments
 (0)