Sub topic 9
Doing it in Setup: Deployment Status and change sets
This chapter shows how to validate and quick deploy from the Setup UI instead of the CLI. It assumes you know what a validation-only deployment is, how test levels work, and what makes a validation eligible for quick deploy. It also assumes you have a sandbox and a production org connected through a deployment connection.
Where the UI fits
The CLI works from a local project and a manifest. Setup works from change sets. A change set is a bundle of metadata components that you build in a source org, usually a sandbox, and upload to a target org. The target org receives it as an inbound change set.
Validation and quick deploy are the same operations in both tools. They differ only in where you click.
Validating an inbound change set
You validate in the target org, not the source org. Production must have an inbound deployment connection from the sandbox that uploaded the change set.
- In the sandbox, open Setup and go to Outbound Change Sets. Create a change set and add your components, for example the
AccountServiceandAccountServiceTestApex classes. - Click Upload and choose the production org as the target.
- Sign in to production. In Setup, search for Inbound Change Sets and open the uploaded change set.
- Click Validate.
- Choose a test level. Production offers Default, Run local tests, Run all tests in your org, and Run specified tests. If you pick Run specified tests, type the names of the test classes.
- Click Validate again to start.
Nothing is saved to production. The org only checks whether the components could be deployed and whether the selected tests pass.
Following progress in Deployment Status
Setup has a page called Deployment Status. Search for it in Quick Find. It lists three groups of deployments:
- In Progress, for validations and deployments that are running.
- Succeeded, for completed ones.
- Failed, for those that stopped with errors.
Open an entry to see the component results, the Apex test results, and the code coverage details. This is the UI version of sf project deploy report. A failed validation shows component errors and failed test methods here, with the class and line when available.
Running a quick deploy from the UI
After a successful validation, the entry appears in the Recent Validations list. Reach it from Deployment Status, or from the Inbound Change Sets page, which has its own Recent Validations section.
- Find the validation you want to promote.
- Click Quick Deploy next to it.
- Confirm the prompt.
The deployment then appears under In Progress in Deployment Status. It skips the Apex tests that already passed during the validation. The action is unavailable when the validation is no longer eligible, for example if it expired or did not meet the coverage and test requirements.
The same validation also has an ID. In the UI it appears in the URL of the deployment detail page and starts with 0Af. This is the ID you would pass to sf project deploy quick --job-id. A validation started in the UI can therefore be promoted from the CLI, and the reverse also works.
sf project deploy quick \
--job-id 0AfXXXXXXXXXXXXXXX \
--target-org prodDifferences from the CLI
| Aspect | Setup UI with change sets | Salesforce CLI |
|---|---|---|
| Input | Uploaded change set | Manifest or source directory |
| Where you start | Target org (inbound change set) | Your terminal, targeting any authorized org |
| Test level choice | Radio buttons in the Validate dialog | `--test-level` flag |
| Status | Deployment Status page | `sf project deploy report` |
| Scripting | Manual | Easy to script in CI |
Change sets also have limits. They only include components that change sets support. They cannot delete components, and they only move metadata between orgs that are connected, such as a sandbox and its production org. If you need destructive changes or unrelated orgs, use the CLI or Metadata API.
Common mistakes
- Looking for Validate in the sandbox. The button is only in the target org's Inbound Change Sets.
- Choosing Default as the test level for a production change set that contains Apex. Default runs no tests if no Apex is in the change set, but runs local tests when Apex components are included, so be explicit about what you intend.
- Waiting too long. A validation is eligible for quick deploy only for a limited time after it succeeds, so schedule it close to the release.
Exercise
You validated an inbound change set in production on Monday and it succeeded. On release day, you cannot find a Quick Deploy button in Recent Validations. Name two possible causes and where you would check.
Show answer
The validation may have expired because too much time passed, or it may not have met the test and coverage requirements for quick deploy, for example it ran with a test level that did not run the required tests. A change in the target org after the validation can also make it ineligible. Check the entry in Deployment Status for the test level, the test results, and the date, then validate again if needed.
Exercise
A teammate starts a validation in the Setup UI. You need to run the quick deploy from a CI script. What do you need from the UI, and which command do you run?
Show answer
You need the validation's job ID, which starts with 0Af. Then run sf project deploy quick --job-id with that ID and --target-org set to the production org.