diff --git a/README.md b/README.md index 129daf2..883509f 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ Link the plugin: sfdx plugins:link . * [`sfdx texei:org:shape:extract [-d ] [-s ] [-u ] [--apiversion ] [--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 ] [-b ] [-p ] [-s ] [-n ] [-w ] [-r] [-a ] [-v ] [-u ] [--apiversion ] [--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 ] [-p ] [--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 ] [--apiversion ] [--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 ] [-u ] [--apiversion ] [--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 ] [-v ] [-u ] [--apiversion ] [--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 -v [-p ] [--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 [-u ] [--apiversion ] [--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 -o [--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 ] [--apiversion ] [--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 ] [-s ] [-u ] [--apiversion ] [--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 bulma@capsulecorp.com" ``` -_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 ] [-b ] [-p ] [-s ] [-n ] [-w ] [-r] [-a ] [-v ] [-u ] [--apiversion ] [--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 ] [-p ] [--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 ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` + +Enable Shared Activities + +``` +USAGE + $ sfdx texei:sharedactivities:enable [-u ] [--apiversion ] [--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 ] [-u ] [--apiversion ] [--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 ] [-v ] [-u ] [--apiversion ] [--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 -v [-p ] [--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 ] [-v ] [-u ] [--apiversion ] [--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 ] [-u ] [--apiversion ] [--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)_ diff --git a/messages/sharedactivities-enable.json b/messages/sharedactivities-enable.json new file mode 100644 index 0000000..4e24a81 --- /dev/null +++ b/messages/sharedactivities-enable.json @@ -0,0 +1,3 @@ +{ + "commandDescription": "Enable Shared Activities" +} \ No newline at end of file diff --git a/package.json b/package.json index 5dadd0e..10eb638 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "texei-sfdx-plugin", "description": "Texeï's plugin for sfdx", - "version": "1.5.2", + "version": "1.6.0", "author": "Texeï", "bugs": "https://github.com/https://github.com/texei/texei-sfdx-plugin/issues", "dependencies": { diff --git a/src/commands/texei/org/contractfieldhistory/fix.ts b/src/commands/texei/org/contractfieldhistory/fix.ts index 132c6a5..eaf819b 100644 --- a/src/commands/texei/org/contractfieldhistory/fix.ts +++ b/src/commands/texei/org/contractfieldhistory/fix.ts @@ -54,10 +54,9 @@ export default class Fix extends SfdxCommand { `${instanceUrl}/secur/frontdoor.jsp?sid=${ this.org.getConnection().accessToken }&startURL=${encodeURIComponent(POST_LOGIN_PATH)}`, - { waitUntil: ["load", "domcontentloaded", "networkidle0"] } + { waitUntil: ["domcontentloaded", "networkidle0"] } ); const navigationPromise = page.waitForNavigation(); - await navigationPromise; this.debug(`DEBUG Opening Contract Field History Tracking page`); await page.goto( diff --git a/src/commands/texei/sharedactivities/enable.ts b/src/commands/texei/sharedactivities/enable.ts new file mode 100644 index 0000000..7ef4913 --- /dev/null +++ b/src/commands/texei/sharedactivities/enable.ts @@ -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 { + 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` }; + } +} \ No newline at end of file diff --git a/src/commands/texei/sharingcalc/suspend.ts b/src/commands/texei/sharingcalc/suspend.ts index b4404d2..c938f1d 100644 --- a/src/commands/texei/sharingcalc/suspend.ts +++ b/src/commands/texei/sharingcalc/suspend.ts @@ -55,7 +55,7 @@ export default class Suspend extends SfdxCommand { const SHARING_CALC_PATH = "/p/own/DeferSharingSetupPage"; - this.ux.startSpinner(`Suspending ${mapSharingLabel.get(this.flags.scope)} Calculations`); + this.ux.startSpinner(`Suspending ${mapSharingLabel.get(this.flags.scope)} Calculations`, null, { stdout: true }); this.debug(`DEBUG Login to Org`); const browser = await puppeteer.launch({ @@ -70,7 +70,6 @@ export default class Suspend extends SfdxCommand { { waitUntil: ["domcontentloaded", "networkidle0"] } ); const navigationPromise = page.waitForNavigation(); - await navigationPromise; this.debug(`DEBUG Opening Defer Sharing Calculations page`);