-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added texei:sharedactivities:enable command
- Loading branch information
1 parent
546e238
commit 9496033
Showing
6 changed files
with
130 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ Link the plugin: sfdx plugins:link . | |
* [`sfdx texei:org:shape:extract [-d <string>] [-s <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiorgshapeextract--d-string--s-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx texei:package:dependencies:install [-k <string>] [-b <string>] [-p <string>] [-s <string>] [-n <string>] [-w <number>] [-r] [-a <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeipackagedependenciesinstall--k-string--b-string--p-string--s-string--n-string--w-number--r--a-string--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx texei:profile:clean [-k <string>] [-p <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiprofileclean--k-string--p-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx texei:sharedactivities:enable [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeisharedactivitiesenable--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx texei:sharingcalc:suspend [-s <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeisharingcalcsuspend--s-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx texei:skinnyprofile:retrieve [-t <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiskinnyprofileretrieve--t-string--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx texei:source:customlabel:replace -l <string> -v <string> [-p <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeisourcecustomlabelreplace--l-string--v-string--p-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
|
@@ -67,7 +68,7 @@ EXAMPLE | |
Data exported! | ||
``` | ||
|
||
_See code: [src/commands/texei/data/export.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/data/export.ts)_ | ||
_See code: [src/commands/texei/data/export.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/data/export.ts)_ | ||
|
||
## `sfdx texei:data:import -d <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -98,7 +99,7 @@ EXAMPLE | |
Data imported! | ||
``` | ||
|
||
_See code: [src/commands/texei/data/import.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/data/import.ts)_ | ||
_See code: [src/commands/texei/data/import.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/data/import.ts)_ | ||
|
||
## `sfdx texei:data:plan:generate -d <string> -o <string> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -125,7 +126,7 @@ EXAMPLE | |
$ sfdx texei:data:plan:generate --objects Account,Contact,MyCustomObject__c --outputdir ./data | ||
``` | ||
|
||
_See code: [src/commands/texei/data/plan/generate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/data/plan/generate.ts)_ | ||
_See code: [src/commands/texei/data/plan/generate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/data/plan/generate.ts)_ | ||
|
||
## `sfdx texei:org:contractfieldhistory:fix [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -153,7 +154,7 @@ EXAMPLE | |
History tracking fixed. | ||
``` | ||
|
||
_See code: [src/commands/texei/org/contractfieldhistory/fix.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/org/contractfieldhistory/fix.ts)_ | ||
_See code: [src/commands/texei/org/contractfieldhistory/fix.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/org/contractfieldhistory/fix.ts)_ | ||
|
||
## `sfdx texei:org:shape:extract [-d <string>] [-s <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -188,7 +189,7 @@ EXAMPLE | |
$ sfdx texei:org:shape:extract -u [email protected]" | ||
``` | ||
|
||
_See code: [src/commands/texei/org/shape/extract.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/org/shape/extract.ts)_ | ||
_See code: [src/commands/texei/org/shape/extract.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/org/shape/extract.ts)_ | ||
|
||
## `sfdx texei:package:dependencies:install [-k <string>] [-b <string>] [-p <string>] [-s <string>] [-n <string>] [-w <number>] [-r] [-a <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -251,7 +252,7 @@ EXAMPLE | |
$ texei:package:dependencies:install -u MyScratchOrg -v MyDevHub -k "1:MyPackage1Key 2: 3:MyPackage3Key" -b "DEV" | ||
``` | ||
|
||
_See code: [src/commands/texei/package/dependencies/install.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/package/dependencies/install.ts)_ | ||
_See code: [src/commands/texei/package/dependencies/install.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/package/dependencies/install.ts)_ | ||
|
||
## `sfdx texei:profile:clean [-k <string>] [-p <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -285,7 +286,34 @@ EXAMPLES | |
custom-sfdx-source-folder/main/profiles,source-folder-2/main/profiles/myAdmin.profile-meta.xml | ||
``` | ||
|
||
_See code: [src/commands/texei/profile/clean.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/profile/clean.ts)_ | ||
_See code: [src/commands/texei/profile/clean.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/profile/clean.ts)_ | ||
|
||
## `sfdx texei:sharedactivities:enable [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
Enable Shared Activities | ||
|
||
``` | ||
USAGE | ||
$ sfdx texei:sharedactivities:enable [-u <string>] [--apiversion <string>] [--json] [--loglevel | ||
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] | ||
OPTIONS | ||
-u, --targetusername=targetusername username or alias for the target | ||
org; overrides default target org | ||
--apiversion=apiversion override the api version used for | ||
api requests made by this command | ||
--json format output as json | ||
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for | ||
this command invocation | ||
EXAMPLE | ||
$ sfdx texei:sharedactivities:enable | ||
``` | ||
|
||
_See code: [src/commands/texei/sharedactivities/enable.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/sharedactivities/enable.ts)_ | ||
|
||
## `sfdx texei:sharingcalc:suspend [-s <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -316,7 +344,7 @@ EXAMPLE | |
Sharing calculations suspended | ||
``` | ||
|
||
_See code: [src/commands/texei/sharingcalc/suspend.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/sharingcalc/suspend.ts)_ | ||
_See code: [src/commands/texei/sharingcalc/suspend.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/sharingcalc/suspend.ts)_ | ||
|
||
## `sfdx texei:skinnyprofile:retrieve [-t <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -349,7 +377,7 @@ EXAMPLE | |
$ texei:skinnyprofile:retrieve -u MyScratchOrg | ||
``` | ||
|
||
_See code: [src/commands/texei/skinnyprofile/retrieve.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/skinnyprofile/retrieve.ts)_ | ||
_See code: [src/commands/texei/skinnyprofile/retrieve.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/skinnyprofile/retrieve.ts)_ | ||
|
||
## `sfdx texei:source:customlabel:replace -l <string> -v <string> [-p <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -373,7 +401,7 @@ EXAMPLE | |
$ texei:source:customlabel:replace --label GreatSalesforceBlog --value https://blog.texei.com | ||
``` | ||
|
||
_See code: [src/commands/texei/source/customlabel/replace.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/source/customlabel/replace.ts)_ | ||
_See code: [src/commands/texei/source/customlabel/replace.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/source/customlabel/replace.ts)_ | ||
|
||
## `sfdx texei:source:layouts:cleanorg [-p <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -406,7 +434,7 @@ EXAMPLES | |
$ texei:source:layouts:cleanorg --targetusername myScratchOrg --targetdevhubusername myDevHub | ||
``` | ||
|
||
_See code: [src/commands/texei/source/layouts/cleanorg.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/source/layouts/cleanorg.ts)_ | ||
_See code: [src/commands/texei/source/layouts/cleanorg.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/source/layouts/cleanorg.ts)_ | ||
|
||
## `sfdx texei:user:update [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
|
@@ -438,5 +466,5 @@ EXAMPLES | |
$ sfdx texei:user:update --values "UserPermissionsKnowledgeUser=true" --json | ||
``` | ||
|
||
_See code: [src/commands/texei/user/update.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.2/src/commands/texei/user/update.ts)_ | ||
_See code: [src/commands/texei/user/update.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.6.0/src/commands/texei/user/update.ts)_ | ||
<!-- commandsstop --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"commandDescription": "Enable Shared Activities" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { core, SfdxCommand } from "@salesforce/command"; | ||
import * as puppeteer from "puppeteer"; | ||
|
||
// Initialize Messages with the current plugin directory | ||
core.Messages.importMessagesDirectory(__dirname); | ||
|
||
// Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core, | ||
// or any library that is using the messages framework can also be loaded this way. | ||
const messages = core.Messages.loadMessages( | ||
"texei-sfdx-plugin", | ||
"sharedactivities-enable" | ||
); | ||
|
||
export default class Enable extends SfdxCommand { | ||
public static description = messages.getMessage("commandDescription"); | ||
|
||
public static examples = [ | ||
`$ sfdx texei:sharedactivities:enable` | ||
]; | ||
|
||
protected static flagsConfig = {}; | ||
|
||
// Comment this out if your command does not require an org username | ||
protected static requiresUsername = true; | ||
|
||
// Comment this out if your command does not support a hub org username | ||
protected static requiresDevhubUsername = false; | ||
|
||
// Set this to true if your command requires a project workspace; 'requiresProject' is false by default | ||
protected static requiresProject = false; | ||
|
||
public async run(): Promise<any> { | ||
let result = {}; | ||
|
||
await this.enableSharedActivities(); | ||
|
||
return result; | ||
} | ||
|
||
private async enableSharedActivities() { | ||
const instanceUrl = this.org.getConnection().instanceUrl; | ||
const ACTIVITIES_SETTINGS_PATH = "/setup/activitiesSetupPage.apexp"; | ||
|
||
this.ux.startSpinner(`Enabling Shared Activities`, null, { stdout: true }); | ||
this.debug(`DEBUG Login to Org`); | ||
|
||
const browser = await puppeteer.launch({ | ||
args: ["--no-sandbox", "--disable-setuid-sandbox"], | ||
headless: !(process.env.BROWSER_DEBUG === "true") | ||
}); | ||
const page = await browser.newPage(); | ||
await page.goto( | ||
`${instanceUrl}/secur/frontdoor.jsp?sid=${ | ||
this.org.getConnection().accessToken | ||
}`, | ||
{ waitUntil: ["domcontentloaded", "networkidle0"] } | ||
); | ||
|
||
const navigationPromise = page.waitForNavigation(); | ||
|
||
this.debug(`DEBUG Opening Activity Settings page`); | ||
await page.goto(`${instanceUrl + ACTIVITIES_SETTINGS_PATH}`); | ||
await navigationPromise; | ||
|
||
this.debug(`DEBUG Clicking 'Allow Users to Relate Multiple Contacts to Tasks and Events' checkbox`); | ||
await page.click( | ||
'input[id="thePage:theForm:theBlock:manyWhoPref"]' | ||
); | ||
|
||
this.debug(`DEBUG Clicking 'Submit' button`); | ||
await page.click( | ||
'input[id="thePage:theForm:theBlock:buttons:submit"]' | ||
); | ||
await navigationPromise; | ||
|
||
this.debug(`DEBUG Closing browser`); | ||
|
||
await browser.close(); | ||
|
||
this.ux.stopSpinner("Done."); | ||
|
||
return { message: `Enabled Shared Activities` }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters