Development Workflow

This guide walks through the complete development workflow using sfp in a modular Salesforce project following the Flxbl framework.

Overview

The development workflow in an sfp-powered project follows an iterative approach where developers work in isolated environments, make changes using source-driven development, and submit their work through pull requests that trigger automated validation and review environments.

{% @mermaid/diagram content="graph LR A[Fetch Environment] --> B[Pull Latest] B --> C[Make Changes] C --> D[Push Changes] D --> E[Test Locally] E --> F[Create PR] F --> G[CI/CD Validation] G --> H[Review Environment] H --> I[Merge]" %}

Prerequisites

DevHub Access Required

Before starting development with sfp, ensure you have:

  1. DevHub access - Required for:

    • Building packages (all types)

    • Creating scratch orgs

    • Managing unlocked packages

  2. DevHub user setup:

    • Your user must be added to the DevHub org

    • Follow Salesforce's guide: Add DevHub License Users

    • Authenticate to your DevHub:

    sf org login web --alias mydevhub --set-default-dev-hub
  3. Verify DevHub connection:

    # Check your DevHub connection
    sf org display --target-dev-hub

1. Starting a New Feature

Fetch a Development Environment

Every feature or story begins with a developer fetching a fresh environment from a pre-prepared pool. The frequency depends on your team's practice:

  • Scratch Orgs: Can be fetched for every story or feature

  • Sandboxes: Typically fetched at the start of an iteration or sprint

Fetch from Server-Managed Pools

Create a New Sandbox (if needed)

Authenticate to Your Environment

Once you have your environment:

2. Development Cycle

Pull Latest Metadata

Before making changes, ensure you have the latest metadata from your org:

The pull command will:

  • Retrieve metadata changes from your org

  • Apply reverse text replacements to convert environment-specific values back to placeholders

  • Update your local source files

Make Your Changes

Now you can work on your feature using your preferred IDE:

  1. Modify existing metadata in package directories

  2. Create new components using SF CLI or your IDE

  3. Add new packages if needed:

  1. Organize packages into logical groups using release configs (domains are conceptual, not explicit commands)

Push Changes to Your Org

Deploy your local changes to the development org:

The push command will:

  • Apply text replacements for environment-specific values

  • Deploy metadata to your org

  • Run tests if specified

Build and Test Locally

Build Artifacts

Test that your packages can be built successfully:

Run Apex Tests

Execute tests in your development org to validate your changes. sfp follows a package-centric testing approach:

For detailed information on test levels, coverage validation, output formats, and CI/CD integration, see Running Apex Tests.

Install to Your Org (Optional)

While developers rarely need to install built artifacts to their own orgs, you can test the installation:

3. Dependency Management

As you develop, you may need to manage package dependencies:

Analyze Dependencies

4. Submitting Your Work

Create a Pull Request

Once your feature is complete:

CI/CD Pipeline Takes Over

When you create a PR, the automated pipeline will:

  1. Run sfp validate to verify your changes:

  1. Create a review environment for acceptance testing:

  1. Run quality checks:

    • Code coverage validation

    • Dependency validation

    • Package structure verification

Review Environment Testing

The review environment URL is posted to your PR for stakeholders to test:

  • Product owners can validate functionality

  • QA can run acceptance tests

  • Other developers can review the implementation

5. Post-Merge

After your PR is approved and merged:

  1. Artifacts are built from the main branch

  2. Published to artifact repository

  3. Ready for release to higher environments

Common Workflows

Working with Aliasified Packages

When working with environment-specific metadata:

Using Text Replacements

For configuration values that change per environment:

Then push/pull will automatically handle replacements:

Handling Destructive Changes

When you need to delete metadata:

  1. Move components to pre-destructive/ or post-destructive/ folders

  2. Push changes normally:

The destructive changes are automatically processed.

Troubleshooting

Pool is Empty

Pool provisioning and replenishment is managed by the sfp server. If pools are consistently empty, contact your administrator to adjust pool configuration via sfp server pool config update.

Push/Pull Conflicts

Build Failures

DevHub Connection Issues

Last updated

Was this helpful?