Skip to content

Commit 4445898

Browse files
committed
Org preference enablement added to disable rollback flags
1 parent 36cad5e commit 4445898

File tree

5 files changed

+37
-50
lines changed

5 files changed

+37
-50
lines changed

src/commands/omnistudio/migration/assess.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { DebugTimer } from '../../../utils';
1111
import { Logger } from '../../../utils/logger';
1212
import OmnistudioRelatedObjectMigrationFacade from '../../../migration/related/OmnistudioRelatedObjectMigrationFacade';
1313
import { OmnistudioOrgDetails, OrgUtils } from '../../../utils/orgUtils';
14-
import { Constants } from '../../../utils/constants/stringContants';
14+
import { OrgPreferences } from '../../../utils/orgpreferences';
1515

1616
Messages.importMessagesDirectory(__dirname);
1717
const messages = Messages.loadMessages('@salesforce/plugin-omnistudio-migration-tool', 'assess');
@@ -108,8 +108,8 @@ export default class Assess extends OmniStudioBaseCommand {
108108
assesmentInfo.lwcAssessmentInfos = relatedObjectAssessmentResult.lwcAssessmentInfos;
109109
assesmentInfo.apexAssessmentInfos = relatedObjectAssessmentResult.apexAssessmentInfos;
110110
}
111-
112-
await AssessmentReporter.generate(assesmentInfo, conn.instanceUrl, orgs, assessOnly, objectsToProcess);
111+
orgs.rollbackFlags = await OrgPreferences.checkRollbackFlags(conn);
112+
await AssessmentReporter.generate(assesmentInfo, conn.instanceUrl, orgs);
113113
return assesmentInfo;
114114
}
115115

src/commands/omnistudio/migration/migrate.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,10 @@ export default class Migrate extends OmniStudioBaseCommand {
9191

9292
// Enable Omni preferences
9393
try {
94-
this.ux.log('Enabling Omni preferences...');
9594
await OrgPreferences.enableOmniPreferences(conn);
96-
this.ux.log('Omni preferences enabled successfully.');
9795
} catch (error) {
9896
const errMsg = error instanceof Error ? error.message : String(error);
99-
this.ux.log(`Error: Could not enable Omni preferences: ${errMsg}`);
97+
this.ux.error(`Could not enable Omni preferences: ${errMsg}`);
10098
throw error;
10199
}
102100

src/utils/interfaces.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,23 @@ export interface oldNew {
144144
old: string;
145145
new: string;
146146
}
147+
148+
export interface OmniStudioSettingsMetadata {
149+
fullName: string;
150+
disableRollbackFlagsPref: boolean;
151+
}
152+
153+
export interface QueryResult {
154+
DeveloperName: string;
155+
Value: string;
156+
totalSize: number;
157+
done: boolean;
158+
records: Array<{
159+
attributes: {
160+
type: string;
161+
url: string;
162+
};
163+
DeveloperName: string;
164+
Value: string;
165+
}>;
166+
}

src/utils/orgpreferences.ts

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,5 @@
11
import { Connection } from '@salesforce/core';
2-
3-
/**
4-
* Interface representing the metadata structure for OmniStudio settings
5-
*
6-
* @interface OmniStudioSettingsMetadata
7-
* @property {string} fullName - The full name of the OmniStudio settings
8-
* @property {boolean} disableRollbackFlagsPref - Flag to disable rollback preferences
9-
*/
10-
interface OmniStudioSettingsMetadata {
11-
fullName: string;
12-
disableRollbackFlagsPref: boolean;
13-
}
14-
15-
/**
16-
* Interface representing the structure of query results from OmniInteractionConfig
17-
*
18-
* @interface QueryResult
19-
* @property {string} DeveloperName - Name of the configuration
20-
* @property {string} Value - Value of the configuration
21-
* @property {number} totalSize - Total number of records returned
22-
* @property {boolean} done - Whether the query is complete
23-
* @property {Array<{attributes: {type: string, url: string}, DeveloperName: string, Value: string}>} records - Array of query result records
24-
*/
25-
interface QueryResult {
26-
DeveloperName: string;
27-
Value: string;
28-
totalSize: number;
29-
done: boolean;
30-
records: Array<{
31-
attributes: {
32-
type: string;
33-
url: string;
34-
};
35-
DeveloperName: string;
36-
Value: string;
37-
}>;
38-
}
2+
import { OmniStudioSettingsMetadata, QueryResult } from './interfaces';
393

404
/**
415
* Class to manage OmniStudio organization preferences
@@ -107,4 +71,4 @@ export class OrgPreferences {
10771
throw new Error(`Failed to check rollback flags: ${error instanceof Error ? error.message : String(error)}`);
10872
}
10973
}
110-
}
74+
}

src/utils/resultsbuilder/assessmentReporter.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class AssessmentReporter {
2929
const integrationProcedureAssessmentFilePath = basePath + '/integration_procedure_assessment.html';
3030
const dataMapperAssessmentFilePath = basePath + '/datamapper_assessment.html';
3131
const apexAssessmentFilePath = basePath + '/apex_assessment.html';
32+
const rollbackFlagsReportPath = basePath + '/rollback_flags_report.html';
3233
// TODO: Uncomment code once MVP for migration is completed
3334
// const lwcAssessmentFilePath = basePath + '/lwc_assessment.html';
3435
const orgDetails: ReportHeaderFormat[] = this.formattedOrgDetails(omnistudioOrgDetails);
@@ -145,8 +146,7 @@ export class AssessmentReporter {
145146
// location: 'lwc_assessment.html',
146147
// },
147148
];
148-
149-
// Check rollback flags
149+
// Check rollback flags
150150
const enabledFlags = omnistudioOrgDetails.rollbackFlags || [];
151151
if (enabledFlags.length > 0) {
152152
const rollbackFlagsReportPath = basePath + '/rollback_flags_report.html';
@@ -302,13 +302,18 @@ export class AssessmentReporter {
302302
}
303303
private static generateRollbackFlagsReport(enabledFlags: string[]): string {
304304
return `
305-
<div class="slds-box slds-theme_warning" style="margin-bottom: 20px;">
306-
<div class="slds-text-heading_medium slds-m-bottom_small">⚠️ Warning: Rollback Flags Enabled</div>
305+
<div class="slds-box rollback-flags-warning">
306+
<div class="slds-text-heading_medium">
307+
<svg class="slds-icon slds-icon_small slds-m-right_x-small" aria-hidden="true">
308+
<use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#warning"></use>
309+
</svg>
310+
Warning: Rollback Flags Enabled
311+
</div>
307312
<p>The following rollback flags are currently enabled and will be disabled during migration:</p>
308-
<ul class="slds-m-top_small">
313+
<ul>
309314
${enabledFlags.map((flag) => `<li>${flag}</li>`).join('')}
310315
</ul>
311-
<p class="slds-m-top_small">
316+
<p>
312317
<strong>Note:</strong> These flags will not be supported after migration. For assistance, please contact support.
313318
</p>
314319
</div>

0 commit comments

Comments
 (0)