Skip to content

Commit 5ffe2da

Browse files
Migration and Assessment of Global Auto Numbers, Enable OmniGlobalAutoNumberPref (#333)
1 parent f2a7598 commit 5ffe2da

20 files changed

+1625
-28
lines changed

README.md

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ sfdx omnistudio:migration:assess -u [email protected]
4141
sfdx omnistudio:migration:migrate -u [email protected]
4242
4343
44-
// To migrate/assess specific components: FlexCards, DataMappers, Integration Procedures, or OmniScripts, add the following parameters:
45-
--only=dr
46-
--only=ip
47-
--only=os
48-
--only=fc
44+
// To migrate/assess specific components: FlexCards, DataMappers, Integration Procedures, OmniScripts, or Global Auto Numbers, add the following parameters:
45+
--only=dr // DataMappers (DataRaptors)
46+
--only=ip // Integration Procedures
47+
--only=os // OmniScripts
48+
--only=fc // FlexCards
49+
--only=autonumber // Global Auto Numbers
4950
5051
// To migrate all versions of the components and not just the active ones:
5152
--allversions
@@ -59,6 +60,47 @@ sfdx omnistudio:migration:migrate -u [email protected]
5960

6061
5. An HTML page will be open in your default browser with the results of your migration/assessment reports.
6162

63+
## Global Auto Number Migration
64+
65+
Global Auto Numbers are components that generate sequential numbers across your Omnistudio org. The migration tool supports both assessment and migration of these components.
66+
67+
### Prerequisites for Global Auto Number Migration
68+
69+
Before migrating Global Auto Numbers, ensure that:
70+
71+
1. **Org Preference is Disabled**: The `OmniGlobalAutoNumberPref` org preference must be disabled before migration
72+
2. **Rollback Flags are Disabled**: Both `RollbackIPChanges` and `RollbackDRChanges` flags must be disabled
73+
3. **Namespace is Specified**: Provide the correct namespace for your OmniStudio package
74+
75+
### Global Auto Number Migration Process
76+
77+
The migration process for Global Auto Numbers includes:
78+
79+
1. **Pre-migration Checks**: Validates that org preferences and rollback flags are properly configured
80+
2. **Data Migration**: Transforms Global Auto Number settings from custom objects to standard Business Process Objects (BPO)
81+
3. **Post-migration Cleanup**: Removes source objects and enables the `OmniGlobalAutoNumberPref` org preference
82+
4. **Validation**: Ensures all records are successfully migrated before cleanup
83+
84+
### Global Auto Number Assessment
85+
86+
Assessment provides detailed information about:
87+
88+
- **Name Changes**: Identifies any naming modifications required to comply with API naming standards
89+
- **Migration Readiness**: Determines if components can be automatically migrated or require manual intervention
90+
- **Warnings**: Highlights potential issues that may affect migration success
91+
92+
### Usage Examples for Global Auto Numbers
93+
94+
```bash
95+
# Assess Global Auto Numbers only
96+
sfdx omnistudio:migration:assess -u [email protected] --only=autonumber
97+
98+
# Migrate Global Auto Numbers only
99+
sfdx omnistudio:migration:migrate -u [email protected] --only=autonumber
100+
```
101+
102+
5. An HTML page will be open in your default browser with the results of your migration/assessment job.
103+
62104
### Assess Usage & parameters
63105

64106
```
@@ -88,7 +130,7 @@ OPTIONS
88130
89131
--only=only specify components to assess:
90132
dr (DataRaptors), ip (Integration Procedures),
91-
os (OmniScripts), fc (FlexCards)
133+
os (OmniScripts), fc (FlexCards), autonumber (Global Auto Numbers)
92134
93135
--relatedobjects=relatedobjects specify related objects to assess:
94136
'apex' for Apex classes

messages/assess.json

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"examples": [
3-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE",
4-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=dr",
5-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=ip",
6-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=os",
7-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=fc"
3+
"omnistudio:migration:assess -u [email protected] ",
4+
"omnistudio:migration:assess -u [email protected] --only=dr",
5+
"omnistudio:migration:assess -u [email protected] --only=ip",
6+
"omnistudio:migration:assess -u [email protected] --only=os",
7+
"omnistudio:migration:assess -u [email protected] --only=fc",
8+
"omnistudio:migration:assess -u [email protected] --only=autonumber"
89
],
910
"commandDescription": "Assess migration of omnistudio components from custom objects to standard objects",
1011
"namespaceFlagDescription": "The namespaced of the package",
1112
"apiVersionFlagDescription": "The Salesforce API version to use",
1213
"errorNoOrgResults": "No results found for the org '%s'.",
13-
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dr",
14-
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr",
14+
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dr | autonumber",
15+
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr | autonumber",
1516
"couldNotDeactivateOmniProcesses": "Could not deactivate current OmniProcesses",
1617
"couldNotTruncate": "Could not truncate {0}",
1718
"couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.",
@@ -39,13 +40,17 @@
3940
"formulaSyntaxError": "There was some problem while updating the formula syntax, please check the all the formula's syntax once : %s",
4041
"errorDuringFlexCardAssessment": "Error during FlexCard assessment",
4142
"errorDuringOmniScriptAssessment": "Error during OmniScript assessment",
43+
"errorDuringGlobalAutoNumberAssessment": "Error during GlobalAutoNumber assessment",
4244
"processingFlexCard": "Processing FlexCard: %s",
4345
"processingDataRaptor": "Processing DataRaptor: %s",
4446
"processingOmniScript": "Processing OmniScript: %s",
47+
"processingGlobalAutoNumber": "Processing GlobalAutoNumber: %s",
4548
"foundDataRaptorsToAssess": "Found %s DataRaptors to assess",
4649
"foundOmniScriptsToAssess": "Found %s OmniScripts and Integration Procedures to assess",
50+
"foundGlobalAutoNumbersToAssess": "Found %s GlobalAutoNumbers to assess",
4751
"startingDataRaptorAssessment": "Starting DataRaptor assessment",
4852
"startingOmniScriptAssessment": "Starting OmniScript assessment",
53+
"startingGlobalAutoNumberAssessment": "Starting GlobalAutoNumber assessment",
4954
"allVersionsInfo": "allVersions : %s",
5055
"assessmentInitialization": "Assessment Initialization: Using namespace: %s",
5156
"apiVersionInfo": "API Version: %s",
@@ -57,6 +62,9 @@
5762
"flexCardAssessment": "FlexCard Assessment",
5863
"assessedFlexCardsCount": "Assessed %s FlexCards",
5964
"flexCardAssessmentCompleted": "FlexCard assessment completed",
65+
"globalAutoNumberAssessment": "GlobalAutoNumber Assessment",
66+
"assessedGlobalAutoNumbersCount": "Assessed %s GlobalAutoNumbers",
67+
"globalAutoNumberAssessmentCompleted": "GlobalAutoNumber assessment completed",
6068
"omniScriptAssessment": "OmniScript and Integration Procedure Assessment",
6169
"assessedOmniScriptsCount": "Assessed %s OmniScripts",
6270
"assessedIntegrationProceduresCount": "Assessed %s Integration Procedures",
@@ -89,6 +97,8 @@
8997
"methodCallBundleNameUpdated": "Method call bundle name will be updated in %s for class %s method %s",
9098
"cardNameChangeMessage": "Card name will be changed from {0} to {1} to follow API naming standards",
9199
"authordNameChangeMessage": "Author name will be changed from {0} to {1} to follow API naming standards",
100+
"globalAutoNumberNameChangeMessage": "GlobalAutoNumber name will be changed from %s to %s to follow API naming standards",
101+
"duplicateGlobalAutoNumberNameMessage": "Potential duplicate: Another Global Auto Number has the same name %s after name cleaning. This may cause conflicts during migration",
92102
"omniScriptNameChangeMessage": "OmniScript reference part {0} will be changed to {1} during migration.",
93103
"dataRaptorNameChangeMessage": "DataRaptor reference {0} will be changed to {1} during migration.",
94104
"integrationProcedureNameChangeMessage": "Integration Procedure reference {0} will be changed to {1} during migration.",

messages/migrate.json

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
{
22
"examples": [
3-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE",
4-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=dr",
5-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=ip",
6-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=os",
7-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=fc",
8-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE -r apex,lwc",
9-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE -r apex",
10-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE -r lwc"
3+
"omnistudio:migration:migrate -u [email protected] ",
4+
"omnistudio:migration:migrate -u [email protected] --only=dr",
5+
"omnistudio:migration:migrate -u [email protected] --only=ip",
6+
"omnistudio:migration:migrate -u [email protected] --only=os",
7+
"omnistudio:migration:migrate -u [email protected] --only=fc",
8+
"omnistudio:migration:migrate -u [email protected] --only=autonumber",
9+
"omnistudio:migration:migrate -u [email protected] -r apex,lwc",
10+
"omnistudio:migration:migrate -u [email protected] -r apex",
11+
"omnistudio:migration:migrate -u [email protected] -r lwc"
1112
],
1213
"commandDescription": "Migrate omnistudio components from custom objects to standard objects",
1314
"namespaceFlagDescription": "The namespace of the package",
1415
"apiVersionFlagDescription": "The Salesforce API version to use",
1516
"errorNoOrgResults": "No results found for the org '%s'.",
16-
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dr",
17-
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr",
17+
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dr | autonumber",
18+
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr | autonumber",
1819
"couldNotDeactivateOmniProcesses": "Could not deactivate current OmniProcesses",
1920
"couldNotTruncate": "Could not truncate {0}",
2021
"couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.",
@@ -63,11 +64,13 @@
6364
"cleaningComponent": "Cleaning: %s",
6465
"cleaningDone": "Cleaning Done: %s",
6566
"migratingComponent": "Migrating: %s",
67+
"cleaningFailed": "Cleaning Failed: %s",
6668
"migrationCompleted": "Migration completed: %s",
6769
"formulaSyntaxError": "There was some problem while updating the formula syntax, please check the all the formula's syntax once : %s",
6870
"foundDataRaptorsToMigrate": "Found %s DataRaptors to migrate",
6971
"foundFlexCardsToMigrate": "Found %s FlexCards to migrate",
7072
"foundOmniScriptsToMigrate": "Found %s OmniScripts and Integration Procedures to migrate",
73+
"foundGlobalAutoNumbersToMigrate": "Found %s GlobalAutoNumbers to migrate",
7174
"allVersionsInfo": "allVersions : %s",
7275
"migrationInitialization": "Migration Initialization: Using namespace: %s",
7376
"apiVersionInfo": "API Version: %s",
@@ -109,5 +112,26 @@
109112
"errorParsingData": "Error while parsing data for template",
110113
"errorGeneratingHTML": "Error while generating HTML from template for {} with properties {}",
111114
"errorEvaluatingExpression": "Error evaluating expression: {0}, {1}",
112-
"manuallySwitchDesignerToStandardDataModel": "To complete the setup, please manually run the required Apex code to configure OmniStudio Designers to use the Standard Data Model <br> https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_change_the_sobject_data_model_after_migration.htm&type=5"
115+
"manuallySwitchDesignerToStandardDataModel": "To complete the setup, please manually run the required Apex code to configure OmniStudio Designers to use the Standard Data Model <br> https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_change_the_sobject_data_model_after_migration.htm&type=5",
116+
"omniGlobalAutoNumberPrefEnabled": "Successfully enabled OmniGlobalAutoNumberPref org preference",
117+
"errorEnablingOmniGlobalAutoNumberPref": "Error enabling OmniGlobalAutoNumberPref org preference",
118+
"performingPreMigrationChecks": "Performing pre-migration checks for Global Auto Number...",
119+
"preMigrationChecksPassed": "Pre-migration checks passed. Proceeding with Global Auto Number migration.",
120+
"preMigrationChecksFailed": "Pre-migration checks failed. Migration cannot proceed.",
121+
"globalAutoNumberPrefEnabledError": "Global Auto Number preference (OmniGlobalAutoNumberPref) is enabled. Please disable it before proceeding with migration.",
122+
"bothRollbackFlagsEnabledError": "Both RollbackIPChanges and RollbackDRChanges flags are enabled. Please disable both flags before proceeding with Global Auto Number migration.",
123+
"rollbackIPFlagEnabledError": "RollbackIPChanges flag is enabled. Please disable this flag before proceeding with Global Auto Number migration.",
124+
"rollbackDRFlagEnabledError": "RollbackDRChanges flag is enabled. Please disable this flag before proceeding with Global Auto Number migration.",
125+
"errorCheckingRollbackFlags": "Error checking rollback flags status.",
126+
"startingPostMigrationCleanup": "Starting post-migration cleanup for Global Auto Number...",
127+
"postMigrationCleanupCompleted": "Post-migration cleanup completed successfully.",
128+
"errorDuringPostMigrationCleanup": "Error during post-migration cleanup.",
129+
"globalAutoNumberNameChangeMessage": "Global Auto Number name has been modified to fit naming rules: %s",
130+
"duplicatedGlobalAutoNumberName": "Duplicated Global Auto Number name",
131+
"errorWhileUploadingGlobalAutoNumber": "An error occurred while uploading Global Auto Number: ",
132+
"startingGlobalAutoNumberAssessment": "Starting Global Auto Number assessment...",
133+
"foundGlobalAutoNumbersToAssess": "Found %s Global Auto Numbers to assess",
134+
"unexpectedError": "An unexpected error occurred during processing",
135+
"migrationValidationFailed": "Post Migration validation failed.",
136+
"incompleteMigrationDetected": "Incomplete migration detected. Source objects: %s, Target objects: %s."
113137
}

src/commands/omnistudio/migration/assess.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { AssessmentReporter } from '../../../utils/resultsbuilder/assessmentRepo
77
import { OmniScriptExportType, OmniScriptMigrationTool } from '../../../migration/omniscript';
88
import { CardMigrationTool } from '../../../migration/flexcard';
99
import { DataRaptorMigrationTool } from '../../../migration/dataraptor';
10+
import { GlobalAutoNumberMigrationTool } from '../../../migration/globalautonumber';
1011
import { DebugTimer } from '../../../utils';
1112
import { Logger } from '../../../utils/logger';
1213
import OmnistudioRelatedObjectMigrationFacade from '../../../migration/related/OmnistudioRelatedObjectMigrationFacade';
@@ -102,6 +103,7 @@ export default class Assess extends OmniStudioBaseCommand {
102103
apexAssessmentInfos: [],
103104
dataRaptorAssessmentInfos: [],
104105
flexCardAssessmentInfos: [],
106+
globalAutoNumberAssessmentInfos: [],
105107
omniAssessmentInfo: {
106108
osAssessmentInfos: [],
107109
ipAssessmentInfos: [],
@@ -164,6 +166,7 @@ export default class Assess extends OmniStudioBaseCommand {
164166
await this.assessDataRaptors(assesmentInfo, namespace, conn);
165167
await this.assessFlexCards(assesmentInfo, namespace, conn, allVersions);
166168
await this.assessOmniScripts(assesmentInfo, namespace, conn, allVersions, OmniScriptExportType.All);
169+
await this.assessGlobalAutoNumbers(assesmentInfo, namespace, conn);
167170
return;
168171
}
169172

@@ -180,6 +183,9 @@ export default class Assess extends OmniStudioBaseCommand {
180183
case Constants.IntegrationProcedure:
181184
await this.assessOmniScripts(assesmentInfo, namespace, conn, allVersions, OmniScriptExportType.IP);
182185
break;
186+
case Constants.GlobalAutoNumber:
187+
await this.assessGlobalAutoNumbers(assesmentInfo, namespace, conn);
188+
break;
183189
default:
184190
throw new Error(messages.getMessage('invalidOnlyFlag'));
185191
}
@@ -230,4 +236,18 @@ export default class Assess extends OmniStudioBaseCommand {
230236
);
231237
Logger.log(messages.getMessage('omniScriptAssessmentCompleted'));
232238
}
239+
240+
private async assessGlobalAutoNumbers(
241+
assesmentInfo: AssessmentInfo,
242+
namespace: string,
243+
conn: Connection
244+
): Promise<void> {
245+
Logger.logVerbose(messages.getMessage('startingGlobalAutoNumberAssessment'));
246+
const globalAutoNumberMigrationTool = new GlobalAutoNumberMigrationTool(namespace, conn, Logger, messages, this.ux);
247+
assesmentInfo.globalAutoNumberAssessmentInfos = await globalAutoNumberMigrationTool.assess();
248+
Logger.logVerbose(
249+
messages.getMessage('assessedGlobalAutoNumbersCount', [assesmentInfo.globalAutoNumberAssessmentInfos.length])
250+
);
251+
Logger.log(messages.getMessage('globalAutoNumberAssessmentCompleted'));
252+
}
233253
}

0 commit comments

Comments
 (0)