---
schema_version: "1"
id: 994847910439a9818c9301964ff2ccbe93c67acf9647a330c4d61147795f5087
title: "Quick Start: Use Salesforce CLI with Lifecycle Center"
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/devops_center_cli_quick_start.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.devops_center_cli_quick_start.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: b6a1e3a6cba482992f0d43c3e17fb6d1aea669bfcbbc6f4d4e580ced54ada04f
description: Use Salesforce CLI to automate Lifecycle Center tasks from the command line. In this quick start, you create and activate a pipeline, manage a work item, and promote changes to the next pipeline stage.
products:
  - Salesforce Platform
release: "264"
---
# Quick Start: Use Salesforce CLI with Lifecycle Center

Use Salesforce CLI to automate Lifecycle Center tasks from the command line. In this quick start, you create and activate a pipeline, manage a work item, and promote changes to the next pipeline stage.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience in <strong>Professional</strong> (API access required), <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Not available in: <strong>Government Cloud Plus</strong>. Contact your Salesforce account executive for more details.</td></tr></tbody><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Not available in: <strong>EU Operating</strong> Zone. EU Operating zone is a special paid offering that provides an enhanced level of data residency commitment. Lifecycle Center <em>is</em> supported in orgs in the EU that aren't part of EU OZ, per standard product terms and conditions.</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d6344e106">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d6344e106 ">To create a pipeline:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d6344e106 ">Lifecycle Center Admin</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d6344e106 ">To promote changes through the pipeline:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d6344e106 ">Lifecycle Center Deployment Manager</td>

          </tr>
        </tbody>
      </table>

For all available flags and options, see [Salesforce CLI Command Reference](https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_devops.html).

Before you begin, complete these tasks.

- Install Salesforce CLI. See [Install Salesforce CLI](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm).
- Install the Lifecycle Center plugin.
    
    ```
    sf plugins install @salesforce/plugin-devops-center
    ```
- Authenticate to the org where Lifecycle Center is available. This quick start uses `my-devops-org` as the org alias.
    
    ```
    sf org login web --alias my-devops-org
    ```
- Create a Lifecycle Center project from the UI.
- Connect the GitHub (or Bitbucket) repository to your Lifecycle Center org.
- Set the authenticated org as the default org.
    
    ```
    sf config set target-org=my-devops-org
    ```
    
    Setting the target org omits `--target-org my-devops-org` from subsequent commands. This quick start includes the flag in each command so that the target org is clear.

## Set Up a Pipeline

Create a pipeline, add and configure its stages, activate the pipeline, and attach your project.

1. List your projects to find the project ID.
    
    ```
    sf devops project list --target-org my-devops-org
    ```
    
    Copy the ID of the project that you want to attach to the pipeline. The examples in this quick start use `0Hn000000000001`.
2. Create an inactive pipeline and connect it to your repository.
    
    ```
    sf devops pipeline create --target-org my-devops-org --name "Release Pipeline" --repo https://github.com/myorg/myrepo
    ```
    
    Copy the pipeline ID from the command output. The examples in this quick start use `0XB000000000001`.
    
    The pipeline remains inactive until you configure its stages and activate it.
    
    To create a repository while creating the pipeline, use `--create-repo` with `--repo-type github|bitbucket`.
3. Add stages to your pipeline. A new pipeline includes a default final stage. Add each new stage before an existing stage by specifying that existing stage with `--next-stage-id`.
    
    For example, add an Integration stage.
    
    ```
    sf devops pipeline stage add --target-org my-devops-org --pipeline-id 0XB000000000001 --name "Integration" --next-stage-id 0Xc000000000001
    ```
    
    Copy the stage ID from the command output. The remaining examples use `0Xc000000000005` for the integration stage. Repeat the command for each additional stage, such as UAT.
    
    ![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-devops_center-264-0-0-production-enus/166010c3-4c34-4087-92ad-aea917baf524/images/icon_tip.png)
    
    Tip View your pipeline in the Lifecycle Center UI to get the stage IDs for subsequent commands. Or run `sf devops pipeline get --pipeline-id 0XB000000000001`.
4. Configure each stage. Each stage requires a branch and an environment. Configure stages from right to left because the final stage must have a branch before you can configure the stages before it.
    
    Add a branch to the Integration stage. The `--create-vcs-branch` flag creates the branch in the repository if it doesn't exist.
    
    ```
    sf devops stage branch add --target-org my-devops-org --pipeline-id 0XB000000000001 --stage-id 0Xc000000000005 --branch-name integration --create-vcs-branch
    ```
    
    Add a sandbox environment to the stage.
    
    ```
    sf devops stage environment add --target-org my-devops-org --pipeline-id 0XB000000000001 --stage-id 0Xc000000000005 --environment-name Integration_Org --org-type Sandbox
    ```
    
    A browser window opens so that you can authenticate to the environment. Use `--org-type Production` for production orgs. In a headless environment, add `--no-browser` and follow the authentication instructions returned by the command.
    
    Repeat the branch and environment commands for every stage. Use the branch name, environment name, and org type appropriate for each stage.
5. Activate the pipeline.
    
    ![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-devops_center-264-0-0-production-enus/166010c3-4c34-4087-92ad-aea917baf524/images/icon_important.png)
    
    Important You can't modify the pipeline stage after you promote changes through it. Make sure that all stages are configured correctly before you run this command.
    
    ```
    sf devops pipeline update --target-org my-devops-org --pipeline-id 0XB000000000001 --activate
    ```
6. Attach your Lifecycle Center project to the pipeline.
    
    ```
    sf devops pipeline project add --target-org my-devops-org --pipeline-id 0XB000000000001 --project-id 0Hn000000000001
    ```
    
    The pipeline is ready. Create work items in the Lifecycle Center UI or run the `sf devops work-item create` command.

## Manage a Work Item

Complete a development cycle by starting a work item, committing your changes, creating a review, and marking the work item ready to promote.

You can pass `--work-item-id` instead of `--work-item-name` in all work-item and review commands.

1. Set the work item status to **In Progress**. Lifecycle Center creates a feature branch for the work item.
    
    ```
    sf devops work-item update --target-org my-devops-org --work-item-name WI-000042 --status "In Progress"
    ```
2. Fetch the feature branch from the connected repository and check it out in your local project.
    
    ```
    git fetch origin
    git checkout WI-000042
    ```
3. Retrieve changes from your development org. This example retrieves an Apex class from the org with the alias `my-sandbox`.
    
    ```
    sf project retrieve start --target-org my-sandbox --metadata ApexClass:MyNewClass
    ```
4. Review the retrieved files, stage them, commit them, and push the feature branch.
    
    ```
    git status
    git add force-app
    git commit -am "Implement new feature"
    git push origin WI-000042
    ```
    
    Adjust the path passed to `git add` if your Salesforce DX project uses a different package directory.
5. Create a change request (pull request) to merge the feature branch into the target branch.
    
    ```
    sf devops review create --target-org my-devops-org --work-item-name WI-000042
    ```
6. Wait for your team to approve and merge the change request.
7. Update the work item status to indicate that it's ready for promotion.
    
    ```
    sf devops work-item update --target-org my-devops-org --work-item-name WI-000042 --status "Ready to Promote"
    ```

## Promote a Work Item

Promote the work item to the next pipeline stage. Lifecycle Center validates the promotion, runs the test suites configured for the target stage, and deploys the changes if the tests pass.

1. Promote the work item, using the work item ID and the target stage ID.
    
    ```
    sf devops promote --target-org my-devops-org --work-item-id 0Wx000000000042 --target-stage-id 0Xc000000000002
    ```
    
    The command output includes a Request ID. Use it to check promotion status.
    
    ```
    Status: Completed
    Message: Work items successfully promoted to UAT.
    Request ID: a0B000000000001
    
    Promoted Work Items
    ───────────────────
    0Wx000000000042
    ```
2. Use the request ID to check the promotion status.
    
    ```
    sf devops request status --target-org my-devops-org --request-token a0B000000000001
    ```

When the request status is completed, the work item is available in the target stage.

## Common Tasks

Use these commands during your daily development workflow.

1. Promote multiple work items to the same stage. Specify `--work-item-id` once for each work item.
    
    ```
    sf devops promote --target-org my-devops-org --work-item-id 0Wx000000000042 --work-item-id 0Wx000000000043 --target-stage-id 0Xc000000000002
    ```
2. Deploy externally merged changes to a stage that's out of sync with Lifecycle Center.
    
    ```
    sf devops promotion complete --target-org my-devops-org --target-stage-id 0Xc000000000002
    ```

## Advanced Use Cases

After completing the basic workflow, use these commands for promotions that require more control.

- Custom promotions: Run `sf devops work-item prepare` to create the required branches and change requests, and then promote the work item.
- Combine work items: Run `sf devops work-item combine` when multiple work items share metadata or have dependencies and must be promoted together.
- Validate before you promote: Run `sf devops promotion validate` to check version control and object permissions without promoting the work items.