Automation Components for the Salesforce Platform

repository·main·Indexed 18 days ago

https://github.com/trailheadapps/automation-components

An open-source toolbox of reusable, production-ready Salesforce extensions, including invocable actions, flow screen components, and local actions. The library provides specialized packages for Apex Formula Evaluator, Collections, Data, Flows, Messaging, Security, Strings, UI, and Utilities.

Tokens
2.4K
Snippets
6
Records
8
Agent score
14%

What's inside Automation Components

  1. Install Automation Components in a Developer Edition or Trailhead Playground

    main

    Use this method to deploy the app to a permanent, non-source-tracked environment like a Developer Edition Org or a Trailhead Playground.

    Steps:

    1. Clone the repository: git clone https://github.com/trailheadapps/automation-components && cd automation-components
    2. Authorize your target org: sf org login web -s -a mydevorg
    3. Deploy the specific source directories: sf project deploy start -d src-collections,src-data,src-flows,src-messaging,src-security,src-strings,src-ui,src-utilities
    4. Open the org: sf org open -o mydevorg
    git clone https://github.com/trailheadapps/automation-components
    cd automation-components
    
    # Authorize target org
    sf org login web -s -a mydevorg
    
    # Deploy all component directories
    sf project deploy start -d src-collections,src-data,src-flows,src-messaging,src-security,src-strings,src-ui,src-utilities
    
    # Open org
    sf org open -o mydevorg
  2. Install Automation Components via Managed Packages

    main

    This is the recommended installation method for deploying components to production or permanent development environments (like Developer Edition Orgs or Trailhead Playgrounds) without needing a local development environment.

    To install, log in to your Salesforce org and use the following links to install the specific managed packages required for your needs:

    | Package Name | Install Link | Documentation Link |
    | --- | --- | --- |
    | Apex Formula Evaluator | [Install](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5w000005hlW8AAI) | [Documentation](https://github.com/trailheadapps/automation-components/wiki/apex-formula-evaluator) |
    | Collections | [Install](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5w000005hlW3AAI) | [Documentation](https://github.com/trailheadapps/automation-components/wiki/collections) |
    | Data | [Install](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5w000005hlWDAAY) | [Documentation](https://github.com/trailheadapps/automation-components/wiki/data) |
    | Flows | [Install](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5w000005hlWIAAY) | [Documentation](https://github.com/trailheadapps/automation-components/wiki/flows) |
    | Messaging | [Install](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5w000005hlWSAAY) | [Documentation](https://github.com/trailheadapps/automation-components/wiki/messaging) |
    | Security | [Install](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5w000005hlWNAAY) | [Documentation](https://github.com/trailheadapps/automation-components/wiki/security) |
    | Strings | [Install](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5w000005hlWcAAI) | [Documentation](https://github.com/trailheadapps/automation-components/wiki/strings) |
    | UI | [Install](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5w000005hlWXAAY) | [Documentation](https://github.com/trailheadapps/automation-components/wiki/ui) |
    | Utilities | [Install](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5w000005hlWhAAI) | [Documentation](https://github.com/trailheadapps/automation-components/wiki/utilities) |
  3. Configure Code Formatting and Linting

    main

    This repository includes configuration for modern web development tooling to ensure code consistency and quality.

    Code Formatting (Prettier)

    • Uses Prettier with .prettierrc and .prettierignore files.
    • Requirement: The Apex Prettier plugin requires Java 11 or above.
    • VS Code Setup: Install the esbenp.prettier-vscode extension.
    • Manual Run: npm run prettier

    Code Linting (ESLint)

    • Uses ESLint with .eslintignore to identify stylistic and logical errors in JavaScript/LWC.
    • VS Code Setup: Install the salesforce.salesforcedx-vscode-lwc extension.
    • Manual Run: npm run lint
  4. Install Automation Components using a Scratch Org

    main

    Use this method if you are a developer who wants to explore the components and the source code.

    Prerequisites:

    • Enable Dev Hub in your Trailhead Playground.
    • Install Salesforce CLI.
    • Install Visual Studio Code with the Salesforce Extension Pack (including the Lightning Web Components extension).

    Steps:

    1. Authorize your hub org: sf org login web -d -a myhuborg
    2. Clone the repository: git clone https://github.com/trailheadapps/automation-components && cd automation-components
    3. Create a scratch org: sf org create scratch -d -f config/project-scratch-def.json -c -a automation
    4. Deploy the app: sf project deploy start
    5. Open the org: sf org open
    # Authorize hub
    sf org login web -d -a myhuborg
    
    # Clone and enter repo
    git clone https://github.com/trailheadapps/automation-components
    cd automation-components
    
    # Create scratch org
    sf org create scratch -d -f config/project-scratch-def.json -c -a automation
    
    # Deploy
    sf project deploy start
    
    # Open
    sf org open
  5. Set up Pre-commit Hooks for Linting and Formatting

    main

    To enforce code quality automatically, you can set up a pre-commit hook that runs Prettier and ESLint every time you run git commit. If linting errors are detected, the commit will fail.

    Setup Steps:

    1. Ensure Node.js is installed.
    2. Run npm install in the project root to install the necessary ESLint and Prettier modules.

    Manual Commands:

    • npm run lint
    • npm run prettier
    npm install
  6. Install Automation Components in a Scratch Org via Windows Batch

    main

    Use the install-scratch.bat script to automate the setup of a Salesforce scratch org for the Automation Components project. The script performs the following sequence:

    1. Deletes any existing scratch org with the alias automation-components.
    2. Creates a new scratch org using the definition found in config/project-scratch-def.json with a 30-day duration.
    3. Deploys the project source code to the newly created org.
    4. Opens the org in your browser at the Lightning Home page upon successful completion.

    Prerequisites:

    • Windows environment.
    • Salesforce CLI (sf) installed and configured.
    • The script must be run from within the repository directory.
    b
    install-scratch.bat
  7. Install Automation Components using a Scratch Org

    main

    To set up a development environment for Automation Components, you can run the provided installation script. This script automates the process of cleaning up existing scratch orgs with the same alias, creating a new scratch org using the project's scratch definition, deploying the source code, and opening the org in your browser.

    Prerequisites:

    • Salesforce CLI (sf) installed and authenticated.
    • The project source must be present in the directory where the script is executed.

    Execution: Run the script from your terminal:

    ./bin/install-scratch.sh
    #!/bin/bash
    ./bin/install-scratch.sh