Skip to content

Commit 60fe376

Browse files
Merge pull request #210 from salesforcecli/prerelease/jschonning/W-14245254-allVersionsFlag
Prerelease/jschonning/w14245254allVersionsFlagBeta
2 parents 13e8aba + 3b099af commit 60fe376

File tree

14 files changed

+1447
-1134
lines changed

14 files changed

+1447
-1134
lines changed

DEV.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
OmniStudio Migration Tool
2-
=========================
1+
# OmniStudio Migration Tool
32

43
This repository contains the code required to enable the OmniStudio Migration Tool SFDX plugin.
54

@@ -9,7 +8,8 @@ This repository contains the code required to enable the OmniStudio Migration To
98
2. Authenticate your SFDX cli into the org you are going to use for development. You can follow authentication steps [here](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_auth_web.htm).
109
3. Clone this repository into your local machine.
1110
4. Open the migration tool code folder in VSCode or your prefered editor.
12-
5. In a new command line tool, run the following command:
11+
5. In a new command line tool, run the following command:
12+
1313
```
1414
bin/run omnistudio:migration:migrate -u [email protected] --namespace=agarciana46_238 --json
1515
```
@@ -18,7 +18,7 @@ bin/run omnistudio:migration:migrate -u [email protected]
1818

1919
```
2020
USAGE
21-
$ sfdx omnistudio:migration:migrate [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
21+
$ sfdx omnistudio:migration:migrate [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
2222
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
2323
2424
OPTIONS
@@ -38,11 +38,14 @@ OPTIONS
3838
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
3939
this command invocation
4040
41+
-a, --allversions migrate all versions
42+
4143
```
4244

4345
### Folder structure
46+
4447
```
45-
-
48+
-
4649
- .vscode VSCode configuration folder
4750
- bin Tools required to run in developer mode
4851
- messages JSON files with user messages used in the plugin
@@ -53,31 +56,35 @@ OPTIONS
5356
- utils Utilities (network, debugging, logging, etc.)
5457
```
5558

56-
57-
5859
_See code: [src/commands/hello/org.ts](https://github.com/agarcia-sf/omnistudio-migration-tool/blob/v0.0.0/src/commands/hello/org.ts)_
60+
5961
<!-- commandsstop -->
6062
<!-- debugging-your-plugin -->
63+
6164
# Debugging your plugin
65+
6266
We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the `.vscode` directory of this plugin is a `launch.json` config file, which allows you to attach a debugger to the node process when running your commands.
6367

64-
To debug the `hello:org` command:
68+
To debug the `hello:org` command:
69+
6570
1. Start the inspector
66-
67-
If you linked your plugin to the sfdx cli, call your command with the `dev-suspend` switch:
71+
72+
If you linked your plugin to the sfdx cli, call your command with the `dev-suspend` switch:
73+
6874
```sh-session
6975
$ sfdx hello:org -u [email protected] --dev-suspend
7076
```
71-
77+
7278
Alternatively, to call your command using the `bin/run` script, set the `NODE_OPTIONS` environment variable to `--inspect-brk` when starting the debugger:
79+
7380
```sh-session
7481
$ NODE_OPTIONS=--inspect-brk bin/run hello:org -u [email protected]
7582
```
7683

7784
2. Set some breakpoints in your command code
7885
3. Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
7986
4. In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
80-
5. Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
87+
5. Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
8188
6. Hit the green play button at the top middle of VS Code (this play button will be to the right of the play button that you clicked in step #5).
82-
<br><img src=".images/vscodeScreenshot.png" width="480" height="278"><br>
83-
Congrats, you are debugging!
89+
<br><img src=".images/vscodeScreenshot.png" width="480" height="278"><br>
90+
Congrats, you are debugging!

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
OmniStudio Migration Tool
2-
=========================
3-
1+
# OmniStudio Migration Tool
42

53
### Before You Begin
6-
1. Confirm you have an OmniStudio Admin license.
7-
2. Enable Standard OmniStudio Runtime in Setup > OmniStudio Settings.
4+
5+
Read and follow the directions in the Omnistudio migration documentation: https://help.salesforce.com/s/articleView?id=sf.os_migrate_omnistudio_custom_objects_to_standard_objects.htm&type=5
86

97
## Running SFDX plugin
108

119
1. Install SFDX cli using the official documentation located [here](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm).
1210
2. Authenticate your SFDX cli into the org you are going to use for development. You can follow authentication steps [here](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_auth_web.htm).
1311
3. In a new terminal session, install the plugin using the following command
12+
1413
```
1514
sfdx plugins:install @salesforce/plugin-omnistudio-migration-tool
1615
```
16+
1717
4. To run the migration tool, run the following command from your command line tool:
18+
1819
```
1920
// To migrate everything
2021
sfdx omnistudio:migration:migrate -u [email protected] --namespace=VLOCITY_PACKAGE_NAMESPACE
@@ -24,14 +25,18 @@ sfdx omnistudio:migration:migrate -u [email protected] --namespace=VL
2425
--only=ip
2526
--only=os
2627
--only=fc
28+
29+
//to migrate all versions of the components and not just the active ones:
30+
--allversions
2731
```
32+
2833
5. An HTML page will be open in your default browser with the results of your migration job.
2934

3035
### Usage & parameters
3136

3237
```
3338
USAGE
34-
$ sfdx omnistudio:migration:migrate [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
39+
$ sfdx omnistudio:migration:migrate [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
3540
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
3641
3742
OPTIONS
@@ -51,4 +56,7 @@ OPTIONS
5156
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
5257
this command invocation
5358
59+
-a, --allversions migrate all versions and not
60+
and not just the active ones.
61+
5462
```

command-snapshot.json

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,19 @@
22
{
33
"command": "basecommand",
44
"plugin": "@salesforce/plugin-omnistudio-migration-tool",
5-
"flags": [
6-
"apiversion",
7-
"json",
8-
"loglevel",
9-
"targetusername"
10-
],
5+
"flags": ["apiversion", "json", "loglevel", "targetusername"],
116
"alias": []
127
},
138
{
149
"command": "omnistudio:migration:info",
1510
"plugin": "@salesforce/plugin-omnistudio-migration-tool",
16-
"flags": [
17-
"apiversion",
18-
"json",
19-
"loglevel",
20-
"name",
21-
"targetdevhubusername",
22-
"targetusername"
23-
],
11+
"flags": ["allversions", "apiversion", "json", "loglevel", "name", "targetdevhubusername", "targetusername"],
2412
"alias": []
2513
},
2614
{
2715
"command": "omnistudio:migration:migrate",
2816
"plugin": "@salesforce/plugin-omnistudio-migration-tool",
29-
"flags": [
30-
"apiversion",
31-
"json",
32-
"loglevel",
33-
"namespace",
34-
"only",
35-
"targetusername"
36-
],
17+
"flags": ["allversions", "apiversion", "json", "loglevel", "namespace", "only", "targetusername"],
3718
"alias": []
3819
}
39-
]
20+
]

messages/info.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"examples": [
77
"sfdx omnistudio:migration:info --targetusername [email protected] --targetdevhubusername [email protected]",
88
"sfdx omnistudio:migration:info --name myname --targetusername [email protected]"
9-
]
10-
}
9+
],
10+
"allVersionsDescription": "Migrate all versions of a component"
11+
}

messages/migrate.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
"errorWhileActivatingOs": "Could not activate OmniScript / Integration Procedure: ",
2525
"errorWhileActivatingCard": "Could not activate Card: ",
2626
"errorWhileUploadingCard": "An error ocurred while uploading Card: ",
27-
"errorWhileCreatingElements": "An error ocurred while saving OmniScript elements: "
28-
}
27+
"errorWhileCreatingElements": "An error ocurred while saving OmniScript elements: ",
28+
"allVersionsDescription": "Migrate all versions of a component"
29+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/plugin-omnistudio-migration-tool",
33
"description": "This SFDX plugin migrates FlexCard, OmniScript, DataRaptor, and Integration Procedure custom objects to standard objects.",
4-
"version": "1.3.0",
4+
"version": "1.3.1-dev.0",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {

src/commands/omnistudio/migration/info.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export default class Org extends SfdxCommand {
2929
char: 'n',
3030
description: messages.getMessage('nameFlagDescription'),
3131
}),
32+
allversions: flags.boolean({
33+
char: 'a',
34+
description: messages.getMessage('allVersionsDescription'),
35+
required: false,
36+
}),
3237
};
3338

3439
// Comment this out if your command does not require an org username
@@ -42,6 +47,8 @@ export default class Org extends SfdxCommand {
4247

4348
public async run(): Promise<AnyJson> {
4449
const name = (this.flags.name || 'world') as string;
50+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
51+
const allVersions = this.flags.allversions || false;
4552

4653
// this.org is guaranteed because requiresUsername=true, as opposed to supportsUsername
4754
const conn = this.org.getConnection();
@@ -79,6 +86,10 @@ export default class Org extends SfdxCommand {
7986
this.ux.log(`My hub org id is: ${hubOrgId}`);
8087
}
8188

89+
if (allVersions) {
90+
outputString = `${outputString} and all versions will be migrated`;
91+
}
92+
8293
// Return an object to be displayed with --json
8394
return { orgId: this.org.getOrgId(), outputString };
8495
}

src/commands/omnistudio/migration/migrate.ts

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,19 @@ export default class Migrate extends OmniStudioBaseCommand {
4242
char: 'o',
4343
description: messages.getMessage('onlyFlagDescription'),
4444
}),
45+
allversions: flags.boolean({
46+
char: 'a',
47+
description: messages.getMessage('allVersionsDescription'),
48+
required: false,
49+
}),
4550
};
4651

4752
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4853
public async run(): Promise<any> {
4954
const namespace = (this.flags.namespace || 'vlocity_ins') as string;
5055
const apiVersion = (this.flags.apiversion || '55.0') as string;
5156
const migrateOnly = (this.flags.only || '') as string;
57+
const allVersions = this.flags.allversions || false;
5258

5359
// this.org is guaranteed because requiresUsername=true, as opposed to supportsUsername
5460
const conn = this.org.getConnection();
@@ -62,23 +68,47 @@ export default class Migrate extends OmniStudioBaseCommand {
6268
if (!migrateOnly) {
6369
migrationObjects = [
6470
new DataRaptorMigrationTool(namespace, conn, this.logger, messages, this.ux),
65-
new OmniScriptMigrationTool(OmniScriptExportType.All, namespace, conn, this.logger, messages, this.ux),
66-
new CardMigrationTool(namespace, conn, this.logger, messages, this.ux),
71+
new OmniScriptMigrationTool(
72+
OmniScriptExportType.All,
73+
namespace,
74+
conn,
75+
this.logger,
76+
messages,
77+
this.ux,
78+
allVersions
79+
),
80+
new CardMigrationTool(namespace, conn, this.logger, messages, this.ux, allVersions),
6781
];
6882
} else {
6983
switch (migrateOnly) {
7084
case 'os':
7185
migrationObjects.push(
72-
new OmniScriptMigrationTool(OmniScriptExportType.OS, namespace, conn, this.logger, messages, this.ux)
86+
new OmniScriptMigrationTool(
87+
OmniScriptExportType.OS,
88+
namespace,
89+
conn,
90+
this.logger,
91+
messages,
92+
this.ux,
93+
allVersions
94+
)
7395
);
7496
break;
7597
case 'ip':
7698
migrationObjects.push(
77-
new OmniScriptMigrationTool(OmniScriptExportType.IP, namespace, conn, this.logger, messages, this.ux)
99+
new OmniScriptMigrationTool(
100+
OmniScriptExportType.IP,
101+
namespace,
102+
conn,
103+
this.logger,
104+
messages,
105+
this.ux,
106+
allVersions
107+
)
78108
);
79109
break;
80110
case 'fc':
81-
migrationObjects.push(new CardMigrationTool(namespace, conn, this.logger, messages, this.ux));
111+
migrationObjects.push(new CardMigrationTool(namespace, conn, this.logger, messages, this.ux, allVersions));
82112
break;
83113
case 'dr':
84114
migrationObjects.push(new DataRaptorMigrationTool(namespace, conn, this.logger, messages, this.ux));

0 commit comments

Comments
 (0)