Enable Dev Hub in your Trailhead Playground or hub org
Install Salesforce CLI
Install Visual Studio Code
Install the Visual Studio Code Salesforce extensions
If you haven't already done so, authorize your hub org and provide it with an alias (myhuborg in the command below):
sf org login web --set-default --alias myhuborg
Clone this repository:
git clone https://github.com/SalesforceLabs/ActionPlansV4
cd ActionPlansV4
From the terminal window, run the installation script
npm run scratchorg
or
. scripts/scratchorg.sh
That's it!
Installing the App using a Developer Edition Org or your own Sandbox Org
Follow this set of instructions if you want to deploy the app to a more permanent environment than a Scratch org. This includes non source-tracked orgs such as a
free Developer Edition Org or a Trailhead Playground, or your own
Sandbox.
Start from a brand-new environment to avoid conflicts with previous work you may have done.
Authorize your org and provide it with an alias (myorg in the command below):
sf org login web --set-default --alias myorg
Clone this repository:
git clone https://github.com/SalesforceLabs/ActionPlansV4
cd ActionPlansV4
If you are setting up a Developer Edition: go to Setup, and under My Domain,
register a My Domain. Then ensure that enhanced domains are activated. You may
need to enable Salesforce Edge network first.
To run all the next steps at once, run this command in the terminal:
. scripts/unmanaged.sh
The org will open. That's it!
Or run these steps one by one
Run this command to deploy the app.
sf deploy metadata --source-dir sfdx-source/LabsActionPlans
Assign the Action_Plans_Admin permission set to the admin user.
sf deploy metadata --source-dir sfdx-source/unmanaged
If your org isn't already open, open it now:
sf org open --target-org myorg
In App Launcher, select the Action Plans app.
Optional Installation Instructions
This repository contains several files that are relevant if you want to add sample data, or integrate modern web development tooling to your Salesforce development
processes or to your continuous integration/continuous deployment processes.
Data/Metadata Import (Optional - NOT available if using the AppExchange managed package)
This repository creates sample data (Accounts, Contacts, Leads) if you choose to create a scratch org. To prevent this, go to the
scratch org definition and change hasSampleData to false.
"hasSampleData": false,
To create a sample Action Plan Template for Account onboarding, run the following:
sf apex run --file ./data/sample-data.apex
To create
a sample Flow that uses the sample template
a sample Account layout
a sample Task layout
a sample report on open Action Plan-related Tasks
sf deploy metadata --source-dir sfdx-source/unmanaged
You can also create other sample Account and Contact records by running the following command:
sf data import tree --plan ./data/action-plan-data-plan.json
Data/Metadata Import (Optional - ONLY if using the AppExchange managed package)
When FIRST installing the package, it will automatically create a sample Action Plan Template for Account onboarding. If you want to recreate it manually, run the
following:
sf apex run --file ./data/sample-data-managed.apex
To create
a sample Flow that uses the sample template
a sample Account layout
a sample Task layout
a sample report on open Action Plan-related Tasks
sf deploy metadata --source-dir sfdx-source/unmanagedExtension
You can also create other sample Account and Contact records by running the following command:
sf data import tree --plan ./data/action-plan-data-plan.json
Code formatting
Prettier is a code formatter used to ensure consistent formatting across your code base. To use Prettier with Visual Studio Code,
install this extension from the Visual Studio Code Marketplace. The
.prettierignore and .prettierrc files are provided as part of this repository to control the behavior of the
Prettier formatter.
Prettier Apex is an extension that handles Apex-specific formatting and allows the removal of the extra
line via the Prettier config file. To use it with Visual Studio Code, follow
these instructions from the Salesforce Extensions site.
Pre-commit hook
This repository also comes with a package.json file that makes it easy to set up a pre-commit hook that enforces code formatting by running
Prettier every time you git commit changes.
Run npm install in your project's root folder to install the Husky and Prettier modules (Note: Mac users should verify that Xcode command line tools
are installed before running this command.)
Husky will now run Prettier automatically every time you commit changes, with some other updates if you installed the recommended extension ApexDox. You can also run
the formatting from the command line using the following command (check out package.json for the full list):