Skip to content

Commit 94f6a62

Browse files
fix: @W-19821724: Flexcard multiple active versions and CX labels feedback
Changes: - Addressed the Flexcards having multipe versions causing issues with assess/migrate - Fixed the issue with OMA to consider version with -a flag and not flag dup/manual - Addressed theCX label feedbakc items - README and messages updates
1 parent 3997f82 commit 94f6a62

28 files changed

+127
-110
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ oclif.manifest.json
4646
omnistudio_migration
4747

4848
assessment_reports/
49-
migration_report/
49+
migration_reports/
5050
.sfdx/
5151
package.xml

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ You can also authenticate using a consumer key (client ID) and secret key throug
3434
3. In a new terminal session, Install the Omnistudio Migration Assistant by running the `sf plugins install` command. For example
3535

3636
```
37-
sf plugins install @salesforce/[email protected].50
37+
sf plugins install @salesforce/[email protected].51
3838
```
3939

4040
4. Run the Omnistudio Migration Assistant from the Salesforce CLI:
@@ -114,7 +114,7 @@ sfdx omnistudio:migration:migrate -u [email protected] --only=autonum
114114

115115
```
116116
USAGE
117-
$ sf omnistudio:migration:assess [-f] [-v <string>] [-u <string>] [--loglevel
117+
$ sf omnistudio:migration:assess [-v <string>] [-u <string>] [--loglevel
118118
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
119119
120120
OPTIONS
@@ -149,7 +149,7 @@ OPTIONS
149149

150150
```
151151
USAGE
152-
$ sf omnistudio:migration:migrate [-f] [-v <string>] [-u <string>] [--loglevel
152+
$ sf omnistudio:migration:migrate [-v <string>] [-u <string>] [--loglevel
153153
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
154154
155155
OPTIONS

messages/assess.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"errorWhileUploadingCard": "We couldn't deploy your Flexcard to your org. Review these errors:",
2626
"errorWhileCreatingElements": "We couldn't save elements in your Omniscript. Review these errors:",
2727
"allVersionsDescription": "Migrate all versions of a component",
28-
"changeMessage": "%s will be changed from %s to %s",
28+
"changeMessage": "The %s %s will be changed from %s to %s",
2929
"angularOSWarning": "We couldn't migrate Angular Omniscripts. Convert all Angular Omniscripts to LWC Omniscripts, and try again.",
3030
"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.",
3131
"noPackageInstalled": "No managed package found in your org.",
@@ -93,7 +93,7 @@
9393
"cardNameChangeMessage": "The Flexcard name will be changed from %s to %s to adhere to the API naming standards.",
9494
"authordNameChangeMessage": "The Flexcard author name will be changed from %s to %s to adhere to the naming rules: %s",
9595
"omniScriptNameChangeMessage": "The Omniscript reference name %s will be changed to %s during migration.",
96-
"dataRaptorNameChangeMessage": "The Data Mapper %s will be renamed to %s during migration.",
96+
"dataRaptorNameChangeMessage": "The Data Mapper name will be changed from %s to %s during migration.",
9797
"integrationProcedureNameChangeMessage": "The Integration Procedure %s will be renamed to %s during migration.",
9898
"integrationProcedureManualUpdateMessage": "All references to %s in this Integration Procedure must be manually updated after migration.",
9999
"duplicateCardNameMessage": "A Flexcard with the same name \"%s\" already exists after name cleaning, which could lead to conflicts during migration.",

messages/migrate.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@
8484
"packageSelectionPrompt": "Enter the number of the package to use (1-%s):",
8585
"invalidPackageSelection": "Invalid selection. Please enter a number between 1 and %s.",
8686
"selectedPackage": "Selected package: %s (Version: %s)",
87-
"dataRaptorNameChangeMessage": "The Data Mapper %s will be renamed to %s during migration.",
87+
"dataRaptorNameChangeMessage": "The Data Mapper name %s will be renamed to %s during migration.",
8888
"integrationProcedureNameChangeMessage": "The Integration Procedure %s will be renamed to %s during migration.",
8989
"integrationProcedureManualUpdateMessage": "All references to %s in this Integration Procedure must be manually updated after migration.",
9090
"cardAuthorNameChangeMessage": "We've modified the name of this Flexcard author to adhere to the naming rules: %s",
9191
"cardNameChangeMessage": "We've modified the name of this Flexcard to adhere to the naming rules: %s",
9292
"duplicateCardNameMessage": "A Flexcard with the same name \"%s\" already exists after name cleaning, which could lead to conflicts during migration.",
93-
"angularOmniscriptWarningMessage": "We couldn't migrate Angular Omniscripts. Convert all Angular Omniscripts to LWC Omniscripts, and try again.",
93+
"angularOmniscriptWarningMessage": "We couldn't migrate Angular Omniscripts.",
9494
"apexFileChangesApplied": "Applied changes to the %s Apex class.",
9595
"generatingComponentReports": "Generating report for components",
9696
"generatingRelatedObjectReports": "Generating report for related objects",
@@ -137,7 +137,7 @@
137137
"enableExperienceBundleMetadataAPIProgramatically": "The ExperienceBundle metadata API needs to be programmatically enabled.",
138138
"unableToEnableExperienceBundleMetadataAPI": "We couldn’t enable the ExperienceBundle metadata API. Experience Cloud sites won’t be processed.",
139139
"relatedObjectsToProcess": "These objects will be processed: %s",
140-
"consentForExperienceSites": "By proceeding further, you hereby consent to enable the ExperienceBundle metadata API and migrate Experience Cloud sites. Do you want to proceed?",
140+
"consentForExperienceSites": "By proceeding further, you hereby consent to enable the ExperienceBundle metadata API and migrate Experience Cloud sites. Do you want to proceed? [y/n]",
141141
"noRelatedObjects": "No related objects to process",
142142
"turnOffExperienceBundleAPI": "Turning off the ExperienceBundle metadata API as it was enabled programmatically.",
143143
"errorRevertingExperienceBundleMetadataAPI": "We couldn’t revert the ExperienceBundle metadata API. Manually revert it in your org.",
@@ -192,7 +192,7 @@
192192
"completeComponentMappingMessage": "Registered name mappings for %s components",
193193
"componentMappingNotFound": "No registry mapping found for %s component: %s, using fallback cleaning",
194194
"integrationProcedureInvalidUnderscoreFormat": "Integration Procedure reference '%s' contains underscores in Type/SubType names. Skipping reference update to avoid incorrect parsing.",
195-
"flexCardWithAngularOmniScriptWarning": "Flexcard has dependencies on Angular Omniscript(s) which are not migrated. Please convert Omniscript(s) to LWC before migrating this Flexcard.",
195+
"flexCardWithAngularOmniScriptWarning": "We couldn't migrate Flexcards with dependencies on Angular Omniscripts.",
196196
"angularOmniScriptDependencyWarning": "Element '%s' references Angular Omniscript '%s' which will not be migrated. Consider converting the referenced Omniscript to LWC",
197197
"skipFlexcardAngularOmniScriptDependencyWarning": "Skipping Flexcard %s due to Angular Omniscript dependencies",
198198
"flexCardMigrationProcessingMessage": "Processing %s Flexcards for migration (%s skipped due to Angular dependencies)",
@@ -203,7 +203,7 @@
203203
"integrationProcedureTypeEmptyAfterCleaning": "Integration Procedure Type '%s' becomes empty after name cleaning. Please provide a valid Type value.",
204204
"integrationProcedureSubtypeEmptyAfterCleaning": "Integration Procedure SubType '%s' becomes empty after name cleaning. Please provide a valid SubType value.",
205205
"manifestDeployementStarted": "Manifest deployment started with ID: %s",
206-
"migrationConsentMessage": "Make sure that all records listed in the Assessment Status column in the Assessment Report are marked as Ready for Migration before proceeding with the migration. Do you want to proceed? Yes or No?",
206+
"migrationConsentMessage": "Make sure that all records listed in the Assessment Status column in the Assessment Report are marked as either Ready for Migration or Warnings before proceeding with the migration. Do you want to proceed? Yes or No?",
207207
"truncationFailed": "Truncation failed for %s: %s",
208208
"invalidTypeMigrateErrorMessage": "We couldn't migrate your Omnistudio components in the %s namespace. Select the correct namespace and try again",
209209
"errorCheckingStandardRuntime": "We couldn't check whether the Standard OmniStudio Runtime setting is enabled: %s. Try again later.",

src/migration/dataraptor.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
import { StringVal } from '../utils/StringValue/stringval';
2424
import { Logger } from '../utils/logger';
2525
import { createProgressBar } from './base';
26+
import { Constants } from '../utils/constants/stringContants';
2627

2728
export class DataRaptorMigrationTool extends BaseMigrationTool implements MigrationTool {
2829
static readonly DRBUNDLE_NAME = 'DRBundle__c';
@@ -317,11 +318,12 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
317318
Logger.info(this.messages.getMessage('processingDataRaptor', [drName]));
318319
const warnings: string[] = [];
319320
const existingDRNameVal = new StringVal(drName, 'name');
320-
let assessmentStatus: 'Ready for migration' | 'Warnings' | 'Needs Manual Intervention' = 'Ready for migration';
321+
let assessmentStatus: 'Ready for migration' | 'Warnings' | 'Needs manual intervention' = 'Ready for migration';
321322

322323
if (!existingDRNameVal.isNameCleaned()) {
323324
warnings.push(
324325
this.messages.getMessage('changeMessage', [
326+
Constants.DataMapperComponentName,
325327
existingDRNameVal.type,
326328
existingDRNameVal.val,
327329
existingDRNameVal.cleanName(),
@@ -333,12 +335,12 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
333335
if (drName && /^[0-9]/.test(drName)) {
334336
const proposedName = 'DM' + this.cleanName(drName);
335337
warnings.push(this.messages.getMessage('dataMapperNameStartsWithNumber', [drName, proposedName]));
336-
assessmentStatus = 'Needs Manual Intervention';
338+
assessmentStatus = 'Needs manual intervention';
337339
}
338340

339341
if (existingDataRaptorNames.has(existingDRNameVal.cleanName())) {
340342
warnings.push(this.messages.getMessage('duplicatedName') + ' ' + existingDRNameVal.cleanName());
341-
assessmentStatus = 'Needs Manual Intervention';
343+
assessmentStatus = 'Needs manual intervention';
342344
} else {
343345
existingDataRaptorNames.add(existingDRNameVal.cleanName());
344346
}

src/migration/flexcard.ts

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
219219
// Check for name changes due to API naming requirements
220220
const originalName: string = flexCardName;
221221
const cleanedName: string = this.cleanName(originalName);
222-
let assessmentStatus: 'Ready for migration' | 'Warnings' | 'Needs Manual Intervention' | 'Failed' =
222+
let assessmentStatus: 'Ready for migration' | 'Warnings' | 'Needs manual intervention' | 'Failed' =
223223
'Ready for migration';
224224
flexCardAssessmentInfo.name = this.allVersions ? `${cleanedName}_${version}` : cleanedName;
225225
if (cleanedName !== originalName) {
@@ -229,12 +229,13 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
229229
assessmentStatus = getUpdatedAssessmentStatus(assessmentStatus, 'Warnings');
230230
}
231231

232-
// Check for duplicate names
233-
if (uniqueNames.has(cleanedName)) {
234-
flexCardAssessmentInfo.warnings.push(this.messages.getMessage('duplicateCardNameMessage', [cleanedName]));
235-
assessmentStatus = getUpdatedAssessmentStatus(assessmentStatus, 'Needs Manual Intervention');
232+
// Check for duplicate names (include version when allVersions is true)
233+
const uniqueCleanedName = this.allVersions ? `${cleanedName}_${version}` : cleanedName;
234+
if (uniqueNames.has(uniqueCleanedName)) {
235+
flexCardAssessmentInfo.warnings.push(this.messages.getMessage('duplicateCardNameMessage', [uniqueCleanedName]));
236+
assessmentStatus = getUpdatedAssessmentStatus(assessmentStatus, 'Needs manual intervention');
236237
}
237-
uniqueNames.add(cleanedName);
238+
uniqueNames.add(uniqueCleanedName);
238239

239240
// Check for author name changes
240241
const originalAuthor = flexCard[this.namespacePrefix + 'Author__c'];
@@ -315,8 +316,12 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
315316
this.messages.getMessage('integrationProcedureManualUpdateMessage', [originalIpMethod])
316317
);
317318
flexCardAssessmentInfo.migrationStatus = getUpdatedAssessmentStatus(
318-
flexCardAssessmentInfo.migrationStatus,
319-
'Needs Manual Intervention'
319+
flexCardAssessmentInfo.migrationStatus as
320+
| 'Warnings'
321+
| 'Needs manual intervention'
322+
| 'Ready for migration'
323+
| 'Failed',
324+
'Needs manual intervention'
320325
);
321326
}
322327
}
@@ -773,14 +778,19 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
773778
}
774779
const transformedCardAuthorName = transformedCard['AuthorName'];
775780

776-
if (uniqueNames.has(transformedCard['Name'])) {
777-
this.setRecordErrors(card, this.messages.getMessage('duplicatedCardName', [transformedCard['Name']]));
781+
// Check for duplicates using version-aware name when allVersions is true
782+
const uniqueCheckName = this.allVersions
783+
? `${transformedCard['Name']}_${transformedCard['VersionNumber']}`
784+
: transformedCard['Name'];
785+
786+
if (uniqueNames.has(uniqueCheckName)) {
787+
this.setRecordErrors(card, this.messages.getMessage('duplicatedCardName', [uniqueCheckName]));
778788
originalRecords.set(recordId, card);
779789
return;
780790
}
781791

782-
// Save the name for duplicated names check
783-
uniqueNames.add(transformedCard['Name']);
792+
// Save the name for duplicated names check (with version if allVersions is true)
793+
uniqueNames.add(uniqueCheckName);
784794

785795
// Create a map of the original records
786796
originalRecords.set(recordId, card);
@@ -879,6 +889,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
879889
} else {
880890
value.migrationSuccess = true;
881891
}
892+
// Use the oldName from nameMapping which already includes version when allVersions is true
882893
let finalKey = `${flexCardAssessmentInfo.nameMapping.oldName}`;
883894
finalKey = finalKey.toLowerCase();
884895
if (storage.fcStorage.has(finalKey)) {

src/migration/omniscript.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
471471
const existingSubTypeVal = new StringVal(existingSubType, 'sub type');
472472
const omniScriptName = omniscript[this.namespacePrefix + 'Name'];
473473
const existingOmniScriptNameVal = new StringVal(omniScriptName, 'name');
474-
let assessmentStatus: 'Ready for migration' | 'Warnings' | 'Needs Manual Intervention' = 'Ready for migration';
474+
let assessmentStatus: 'Ready for migration' | 'Warnings' | 'Needs manual intervention' = 'Ready for migration';
475475

476476
const warnings: string[] = [];
477477
const errors: string[] = [];
@@ -480,19 +480,19 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
480480
if (omniProcessType === 'Integration Procedure') {
481481
if (!existingType || existingType.trim() === '') {
482482
errors.push(this.messages.getMessage('missingMandatoryField', ['Type', 'Integration Procedure']));
483-
assessmentStatus = 'Needs Manual Intervention';
483+
assessmentStatus = 'Needs manual intervention';
484484
}
485485
if (!existingSubType || existingSubType.trim() === '') {
486486
errors.push(this.messages.getMessage('missingMandatoryField', ['SubType', 'Integration Procedure']));
487-
assessmentStatus = 'Needs Manual Intervention';
487+
assessmentStatus = 'Needs manual intervention';
488488
}
489489
}
490490

491491
// Check for Angular OmniScript dependencies
492492
for (const osDep of dependencyOS) {
493493
if (this.nameRegistry.isAngularOmniScript(osDep.name)) {
494494
warnings.push(this.messages.getMessage('angularOmniScriptDependencyWarning', [osDep.location, osDep.name]));
495-
assessmentStatus = 'Needs Manual Intervention';
495+
assessmentStatus = 'Needs manual intervention';
496496
}
497497
}
498498

@@ -519,10 +519,11 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
519519
if (!existingTypeVal.isNameCleaned()) {
520520
if (omniProcessType === 'Integration Procedure' && (!newType || newType.trim() === '')) {
521521
warnings.push(this.messages.getMessage('integrationProcedureTypeEmptyAfterCleaning', [existingTypeVal.val]));
522-
assessmentStatus = 'Needs Manual Intervention';
522+
assessmentStatus = 'Needs manual intervention';
523523
} else {
524524
warnings.push(
525525
this.messages.getMessage('changeMessage', [
526+
omniProcessType,
526527
existingTypeVal.type,
527528
existingTypeVal.val,
528529
existingTypeVal.cleanName(),
@@ -536,10 +537,11 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
536537
warnings.push(
537538
this.messages.getMessage('integrationProcedureSubtypeEmptyAfterCleaning', [existingSubTypeVal.val])
538539
);
539-
assessmentStatus = 'Needs Manual Intervention';
540+
assessmentStatus = 'Needs manual intervention';
540541
} else {
541542
warnings.push(
542543
this.messages.getMessage('changeMessage', [
544+
omniProcessType,
543545
existingSubTypeVal.type,
544546
existingSubTypeVal.val,
545547
existingSubTypeVal.cleanName(),
@@ -552,6 +554,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
552554
if (!existingOmniScriptNameVal.isNameCleaned()) {
553555
warnings.push(
554556
this.messages.getMessage('changeMessage', [
557+
omniProcessType,
555558
existingOmniScriptNameVal.type,
556559
existingOmniScriptNameVal.val,
557560
existingOmniScriptNameVal.cleanName(),
@@ -561,7 +564,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
561564
}
562565
if (existingOmniscriptNames.has(recordName)) {
563566
warnings.push(this.messages.getMessage('duplicatedName') + ' ' + recordName);
564-
assessmentStatus = 'Needs Manual Intervention';
567+
assessmentStatus = 'Needs manual intervention';
565568
} else {
566569
existingOmniscriptNames.add(recordName);
567570
}
@@ -570,21 +573,21 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
570573
if (duplicateElementNames.size > 0) {
571574
const duplicateNamesList = Array.from(duplicateElementNames).join(', ');
572575
warnings.unshift(this.messages.getMessage('invalidOrRepeatingOmniscriptElementNames', [duplicateNamesList]));
573-
assessmentStatus = 'Needs Manual Intervention';
576+
assessmentStatus = 'Needs manual intervention';
574577
}
575578

576579
// Add warning for reserved keys found in PropertySet
577580
if (foundReservedKeys.size > 0) {
578581
const reservedKeysList = Array.from(foundReservedKeys).join(', ');
579582
warnings.unshift(this.messages.getMessage('reservedKeysFoundInPropertySet', [reservedKeysList]));
580-
assessmentStatus = 'Needs Manual Intervention';
583+
assessmentStatus = 'Needs manual intervention';
581584
}
582585

583586
if (omniProcessType === this.OMNISCRIPT) {
584587
const type = omniscript[this.namespacePrefix + 'IsLwcEnabled__c'] ? 'LWC' : 'Angular';
585588
if (type === 'Angular') {
586589
warnings.unshift(this.messages.getMessage('angularOSWarning'));
587-
assessmentStatus = 'Needs Manual Intervention';
590+
assessmentStatus = 'Needs manual intervention';
588591
}
589592
}
590593

0 commit comments

Comments
 (0)