Skip to content

Commit c86e2f3

Browse files
Merge pull request #445 from sf-aastha-paruthi/u/aparuthi/finalchangesforomnistudiopackage
@W-19464615 Usecase3 Changes
2 parents 31f5a0e + 14f3b68 commit c86e2f3

31 files changed

+398
-95
lines changed

messages/assess.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"changeMessage": "The %s %s will be changed from %s to %s",
3030
"angularOSWarning": "We couldn't migrate Angular Omniscripts. Convert all Angular Omniscripts to LWC Omniscripts, and try again.",
3131
"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.",
32-
"noPackageInstalled": "No managed package found in your org.",
32+
"noPackageInstalled": "No valid package found in your org.",
3333
"alreadyStandardModel": "Your org already uses the standard data model.",
3434
"invalidRelatedObjectsOption": "Invalid entry for -r: %s. Enter either apex, lwc, flexipage or expsites.",
3535
"formulaSyntaxError": "We couldn't update the syntax of this formula. Verify the syntax and try again: %s",
@@ -47,7 +47,7 @@
4747
"allVersionsInfo": "All versions: %s",
4848
"assessmentInitialization": "Assessment process started. Using namespace: %s",
4949
"apiVersionInfo": "API version: %s",
50-
"unknownNamespace": "Omnistudio namespace is not configured in this org. Configure the namespace and try again",
50+
"unknownNamespace": "A valid namespace is not configured in this org. Configure the namespace and try again",
5151
"noOmniStudioLicenses": "We couldn’t find Omnistudio licenses in this org. Omnistudio licenses are required for migration assessment",
5252
"assessmentTargets": "Assessment targets: %s",
5353
"relatedObjectsInfo": "Related objects: %s",
@@ -210,6 +210,15 @@
210210
"drVersioningDisabled": "Proceeding with the assessment as the Data Mapper versioning setting is disabled.",
211211
"drVersioningEnabled": "We cannot proceed with the assessment as the Data Mapper versioning setting is enabled in your org.",
212212
"errorValidatingDrVersioning": "Failed to verify the status of the Data Mapper versioning setting. Try again later.",
213+
"validatingOmniInteractionConfig": "Validating Omni Interaction Configuration",
214+
"omniInteractionConfigInvalid": "The Omnistudio Migration Assistant cannot assess components in your org as your org contains both the Omnistudio Foundation package and Vlocity Industries managed package.",
215+
"queryResultSize": "Query result size: %s",
216+
"packagesHaveSameValue": "Both TheFirstInstalledOmniPackage and InstalledIndustryPackage have the same value.",
217+
"packagesHaveDifferentValue": "Both the InstalledIndustryPackage and TheFirstInstalledOmniPackage have different values.",
218+
"failedToCheckPackagesValue": "Failed to check the value of packages in Omni Interaction Configuration.",
219+
"packageDetails": "Your org contains only the TheFirstInstalledOmniPackage Omni Interaction Configuration.",
220+
"orgUsecaseDetails": "The org is on %s data model with %s ",
221+
"globalAutoNumberUnSupportedInOmnistudioPackage": "Omni Global Auto Number is not supported in Omnistudio Foundation package orgs.",
213222
"omniStudioAllVersionsProcessingConsent": "Org uses the standard data model. All versions of Omnistudio components such as Omniscripts, Data Mappers, Integration Procedures, and Flexcards must be assessed. But you’ve not specified -a or allversions flag in the command. Proceed to assess all versions of the Omnistudio components? [y/n]",
214223
"omniStudioAllVersionsProcessingConsentNotGiven": "You've not consented to assess all versions of the Omnistudio components. We cannot proceed with the assessment.",
215224
"omniStudioAllVersionsProcessingConsentGiven": "You've consented to assess all versions of the Omnistudio components."

messages/migrate.json

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"errorWhileCreatingElements": "We couldn't save elements in your Omniscript. Review these errors:",
3131
"allVersionsDescription": "Migrate all versions of a component",
3232
"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.",
33-
"noPackageInstalled": "No managed package found in your org.",
33+
"noPackageInstalled": "No valid package found in your org.",
3434
"alreadyStandardModel": "Your org already uses the standard data model.",
35-
"unknownNamespace": "Org doesn't have Omnistudio namespace(s) configured",
35+
"unknownNamespace": "A valid namespace is not configured in this org. Configure the namespace and try again",
3636
"noOmniStudioLicenses": "OmniStudio licenses are not found in the org. OmniStudio licenses are required for migration",
3737
"invalidRelatedObjectsOption": "Invalid option provided for -r: %s. Valid options are apex, lwc, expsites, flexipage.",
3838
"userConsentMessage": "By proceeding further, you hereby consent to accept changes to your custom code, and the accompanying terms and conditions associated with the use of the Omnistudio Migration Tool. Do you want to proceed? [y/n]",
@@ -48,8 +48,8 @@
4848
"operationCancelled": "Operation cancelled.",
4949
"errorRunningMigrate": "Migration process failed reason : %s",
5050
"exceptionSettingDesignersToStandardDataModel": "We've encountered an exception while configuring the Omnistudio standard designers to use the standard data model. Try again later.",
51-
"enterTargetNamespace": "Enter the target namespace that you want to use for invoking the Apex classes in the Omnistudio managed package.",
52-
"usingTargetNamespace": "Using the target namespace %s for invoking the Apex classes in the Omnistudio managed package.",
51+
"enterTargetNamespace": "Enter the target namespace that you want to use for invoking the Apex classes in the package.",
52+
"usingTargetNamespace": "Using the target namespace %s for invoking the Apex classes in the package.",
5353
"cleaningComponent": "Cleaning: %s",
5454
"cleaningDone": "Cleaning completed: %s",
5555
"migratingComponent": "Migrating: %s",
@@ -82,7 +82,7 @@
8282
"deployingMetadata": "Deploying metadata %s to %s",
8383
"metadataDeployed": "Metadata %s deployed to %s",
8484
"sfProjectCommandError": "Error executing command: %s",
85-
"multiplePackagesFound": "Multiple OmniStudio packages found. Please select one:",
85+
"multiplePackagesFound": "Multiple packages found. Select one:",
8686
"packageSelectionPrompt": "Enter the number of the package to use (1-%s):",
8787
"invalidPackageSelection": "Invalid selection. Please enter a number between 1 and %s.",
8888
"selectedPackage": "Selected package: %s (Version: %s)",
@@ -312,5 +312,14 @@
312312
"validatingDrVersioningDisabled": "Checking the Data Mapper versioning setting in your org.",
313313
"drVersioningDisabled": "Proceeding with the migration as the Data Mapper versioning setting is disabled.",
314314
"drVersioningEnabled": "We cannot proceed with the migration as the Data Mapper versioning setting is enabled in your org.",
315-
"errorValidatingDrVersioning": "Failed to verify the status of the Data Mapper versioning setting. Try again later."
315+
"errorValidatingDrVersioning": "Failed to verify the status of the Data Mapper versioning setting. Try again later.",
316+
"validatingOmniInteractionConfig": "Validating Omni Interaction Configuration",
317+
"omniInteractionConfigInvalid": "The Omnistudio Migration Assistant cannot migrate components in your org as your org contains both the Omnistudio Foundation package and Vlocity Industries managed package.",
318+
"queryResultSize": "Query result size: %s",
319+
"packagesHaveSameValue": "Both TheFirstInstalledOmniPackage and InstalledIndustryPackage have the same value.",
320+
"packagesHaveDifferentValue": "Both the InstalledIndustryPackage and TheFirstInstalledOmniPackage have different values.",
321+
"failedToCheckPackagesValue": "Failed to check the value of packages in Omni Interaction Configuration.",
322+
"packageDetails": "Your org contains only the TheFirstInstalledOmniPackage Omni Interaction Configuration.",
323+
"orgUsecaseDetails": "The Org is on %s data model with %s ",
324+
"globalAutoNumberUnSupportedInOmnistudioPackage": "Omni Global Auto Number is not supported in Omnistudio Foundation package orgs."
316325
}

src/commands/omnistudio/migration/assess.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import { ProjectPathUtil } from '../../../utils/projectPathUtil';
2020
import { PreMigrate } from '../../../migration/premigrate';
2121
import { PostMigrate } from '../../../migration/postMigrate';
2222
import { CustomLabelsUtil } from '../../../utils/customLabels';
23-
import { initializeDataModelService, isStandardDataModel } from '../../../utils/dataModelService';
23+
import { initializeDataModelService, isFoundationPackage } from '../../../utils/dataModelService';
24+
2425
import { ValidatorService } from '../../../utils/validatorService';
2526

2627
Messages.importMessagesDirectory(__dirname);
@@ -96,7 +97,8 @@ export default class Assess extends OmniStudioBaseCommand {
9697
const preMigrate: PreMigrate = new PreMigrate(namespace, conn, this.logger, messages, this.ux);
9798

9899
// Handle all versions prerequisite for standard data model
99-
if (isStandardDataModel()) {
100+
if (
101+
DataModel()) {
100102
allVersions = await preMigrate.handleAllVersionsPrerequisites(allVersions);
101103
}
102104
if (relatedObjects) {
@@ -235,7 +237,9 @@ export default class Assess extends OmniStudioBaseCommand {
235237
await this.assessFlexCards(assesmentInfo, namespace, conn, allVersions);
236238
await this.assessOmniScripts(assesmentInfo, namespace, conn, allVersions, OmniScriptExportType.OS);
237239
await this.assessOmniScripts(assesmentInfo, namespace, conn, allVersions, OmniScriptExportType.IP);
238-
await this.assessGlobalAutoNumbers(assesmentInfo, namespace, conn);
240+
if (!isFoundationPackage()) {
241+
await this.assessGlobalAutoNumbers(assesmentInfo, namespace, conn);
242+
}
239243
await this.assessCustomLabels(assesmentInfo, namespace, conn);
240244
return;
241245
}
@@ -254,7 +258,11 @@ export default class Assess extends OmniStudioBaseCommand {
254258
await this.assessOmniScripts(assesmentInfo, namespace, conn, allVersions, OmniScriptExportType.IP);
255259
break;
256260
case Constants.GlobalAutoNumber:
257-
await this.assessGlobalAutoNumbers(assesmentInfo, namespace, conn);
261+
if (!isFoundationPackage()) {
262+
await this.assessGlobalAutoNumbers(assesmentInfo, namespace, conn);
263+
} else {
264+
Logger.warn(messages.getMessage('globalAutoNumberUnSupportedInOmnistudioPackage'));
265+
}
258266
break;
259267
case Constants.CustomLabel:
260268
await this.assessCustomLabels(assesmentInfo, namespace, conn);
@@ -333,6 +341,9 @@ export default class Assess extends OmniStudioBaseCommand {
333341
namespace: string,
334342
conn: Connection
335343
): Promise<void> {
344+
if (isFoundationPackage()) {
345+
return;
346+
}
336347
Logger.logVerbose(messages.getMessage('startingGlobalAutoNumberAssessment'));
337348
const globalAutoNumberMigrationTool = new GlobalAutoNumberMigrationTool(namespace, conn, Logger, messages, this.ux);
338349
assesmentInfo.globalAutoNumberAssessmentInfos = await globalAutoNumberMigrationTool.assess();

src/commands/omnistudio/migration/migrate.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { GlobalAutoNumberMigrationTool } from '../../../migration/globalautonumb
3434
import {
3535
getFieldKeyForOmniscript,
3636
initializeDataModelService,
37+
isFoundationPackage,
3738
isStandardDataModel,
3839
} from '../../../utils/dataModelService';
3940
import { NameMappingRegistry } from '../../../migration/NameMappingRegistry';
@@ -456,9 +457,11 @@ export default class Migrate extends OmniStudioBaseCommand {
456457
allVersions
457458
),
458459
new CardMigrationTool(namespace, conn, this.logger, messages, this.ux, allVersions),
459-
new GlobalAutoNumberMigrationTool(namespace, conn, this.logger, messages, this.ux),
460460
new CustomLabelsMigrationTool(namespace, conn, this.logger, messages, this.ux),
461461
];
462+
if (!isFoundationPackage()) {
463+
migrationObjects.push(new GlobalAutoNumberMigrationTool(namespace, conn, this.logger, messages, this.ux));
464+
}
462465
} else {
463466
// For single component migration, the order doesn't matter as much
464467
// but we still maintain consistency
@@ -496,6 +499,9 @@ export default class Migrate extends OmniStudioBaseCommand {
496499
migrationObjects.push(new DataRaptorMigrationTool(namespace, conn, this.logger, messages, this.ux));
497500
break;
498501
case Constants.GlobalAutoNumber:
502+
if (isFoundationPackage()) {
503+
Logger.warn(messages.getMessage('globalAutoNumberUnSupportedInOmnistudioPackage'));
504+
}
499505
migrationObjects.push(new GlobalAutoNumberMigrationTool(namespace, conn, this.logger, messages, this.ux));
500506
break;
501507
case Constants.CustomLabel:

src/migration/globalautonumber.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { createProgressBar } from './base';
1414
import { OrgPreferences } from '../utils/orgPreferences';
1515
import { OmnistudioSettingsPrefManager } from '../utils/OmnistudioSettingsPrefManager';
1616
import { Constants } from '../utils/constants/stringContants';
17+
import { isFoundationPackage } from '../utils/dataModelService';
1718

1819
export class GlobalAutoNumberMigrationTool extends BaseMigrationTool implements MigrationTool {
1920
private prefManager: OmnistudioSettingsPrefManager;
@@ -46,6 +47,10 @@ export class GlobalAutoNumberMigrationTool extends BaseMigrationTool implements
4647
}
4748

4849
public async truncate(): Promise<void> {
50+
if (isFoundationPackage()) {
51+
return;
52+
}
53+
4954
try {
5055
// Perform pre-migration checks before truncation
5156
await this.performPreMigrationChecks();
@@ -60,6 +65,17 @@ export class GlobalAutoNumberMigrationTool extends BaseMigrationTool implements
6065
}
6166

6267
public async migrate(): Promise<MigrationResult[]> {
68+
if (isFoundationPackage()) {
69+
// Return a result with empty data so the dashboard can show a tile
70+
return [
71+
{
72+
name: this.getName(),
73+
results: new Map<string, UploadRecordResult>(),
74+
records: new Map<string, any>(),
75+
},
76+
];
77+
}
78+
6379
// Perform pre-migration checks before migration
6480
await this.performPreMigrationChecks();
6581

@@ -274,6 +290,10 @@ export class GlobalAutoNumberMigrationTool extends BaseMigrationTool implements
274290
}
275291

276292
public async assess(): Promise<GlobalAutoNumberAssessmentInfo[]> {
293+
if (isFoundationPackage()) {
294+
return [];
295+
}
296+
277297
try {
278298
DebugTimer.getInstance().lap('Query GlobalAutoNumber settings');
279299
Logger.logVerbose(this.messages.getMessage('startingGlobalAutoNumberAssessment'));

src/templates/assessmentReport.template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@
7979
</div>
8080
</div>
8181

82+
<c:if exp={$notSupportedMessage}>
83+
<div class="slds-box slds-m-top_medium" style="text-align: center; padding: 40px 20px; background-color: #f3f2f2; border: 2px solid #c9c7c5;">
84+
<div class="slds-text-heading_medium" style="color: #3e3e3c; font-weight: bold; margin-bottom: 8px;">
85+
Feature Not Supported
86+
</div>
87+
<div style="color: #3e3e3c; font-size: 16px;">
88+
{{notSupportedMessage}}
89+
</div>
90+
</div>
91+
</c:if>
92+
93+
<c:if exp={!$notSupportedMessage}>
8294
<div class="filter-dropdown-container">
8395
<div class="filter-header-bar">
8496
<!-- Row count display -->
@@ -234,6 +246,7 @@
234246
</div>
235247
</c:if>
236248
</div>
249+
</c:if>
237250
</div>
238251
<div id="cta-summary-panel" class="cta-summary-panel hidden">
239252
<div class="cta-header">

src/templates/migrationReport.template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@
4343
</div>
4444
</div>
4545

46+
<c:if exp={$notSupportedMessage}>
47+
<div class="slds-box slds-m-top_medium" style="text-align: center; padding: 40px 20px; background-color: #f3f2f2; border: 2px solid #c9c7c5;">
48+
<div class="slds-text-heading_medium" style="color: #3e3e3c; font-weight: bold; margin-bottom: 8px;">
49+
Feature Not Supported
50+
</div>
51+
<div style="color: #3e3e3c; font-size: 16px;">
52+
{{notSupportedMessage}}
53+
</div>
54+
</div>
55+
</c:if>
56+
57+
<c:if exp={!$notSupportedMessage}>
4658
<c:if exp={$filterGroups.length>0}>
4759
<div class="filter-dropdown-container">
4860
<div class="filter-header-bar">
@@ -347,6 +359,7 @@
347359
</div>
348360
</div>
349361
</c:if>
362+
</c:if>
350363
</div>
351364
</div>
352365
</body>

src/utils/constants/stringContants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ export const Constants = {
4040
CustomLabelErrorStatus: 'error',
4141
CustomLabelDuplicateStatus: 'duplicate',
4242
CustomLabelSameValueMessage: 'same value',
43+
44+
// Package constants
45+
FoundationPackageName: 'omnistudio',
4346
};

src/utils/dataModelService.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,22 @@ export class DataModelService {
1616
}
1717
return Constants.StandardDataModel;
1818
}
19+
20+
public isFoundationPackage(): boolean {
21+
return this.orgs.isFoundationPackage ?? false;
22+
}
1923
}
2024

2125
// Global instance and cached data model
2226
let globalDataModelService: DataModelService | null = null;
2327
let cachedDataModel: string | null = null;
28+
let cachedIsFoundationPackage: boolean | null = null;
2429

2530
// Initialize the global instance
2631
export function initializeDataModelService(orgs: OmnistudioOrgDetails): void {
2732
globalDataModelService = new DataModelService(orgs);
2833
cachedDataModel = null; // Reset cache when reinitializing
34+
cachedIsFoundationPackage = null; // Reset cache when reinitializing
2935
}
3036

3137
// Get the global instance
@@ -41,6 +47,13 @@ export function getDataModelInfo(): string {
4147
return cachedDataModel;
4248
}
4349

50+
export function isFoundationPackage(): boolean {
51+
if (cachedIsFoundationPackage === null) {
52+
cachedIsFoundationPackage = getDataModelService().isFoundationPackage();
53+
}
54+
return cachedIsFoundationPackage;
55+
}
56+
4457
// Convenience function to check if data model is standard
4558
export function isStandardDataModel(): boolean {
4659
const dataModel = getDataModelInfo();

src/utils/formula/FormulaUtil.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Stack from './Stack';
55
import { DebugTimer } from '../logging/debugtimer';
66
import { QueryTools } from '../query';
77
import { Connection } from '@salesforce/core';
8+
import { isFoundationPackage } from '../dataModelService';
89

910
function getReplacedformulaString(
1011
formulaExpression: string,
@@ -79,6 +80,10 @@ export function getFunctionDefinitionFields(): string[] {
7980

8081
// Get All FunctionDefinition__mdt records
8182
export async function getAllFunctionMetadata(namespace: string, connection: Connection): Promise<AnyJson[]> {
83+
if (isFoundationPackage()) {
84+
// If the org has omnistudio package, then there is no FunctionDefinition__mdt entity in the omnistudio namespace
85+
return [];
86+
}
8287
DebugTimer.getInstance().lap('Query FunctionDefinition__mdt');
8388
return await QueryTools.queryAll(connection, namespace, 'FunctionDefinition__mdt', getFunctionDefinitionFields());
8489
}

0 commit comments

Comments
 (0)