# Create a Scratch Org

### What is a Scratch Org? <a href="#what-is-scratch-org" id="what-is-scratch-org"></a>

A **Scratch Org** is a short-lived Salesforce environment you spin up from your **Developer Hub (Dev Hub)**.\
Developers use scratch orgs to validate proofs of concept, build and test unlocked packages, and experiment safely. You can create—and delete—any number of scratch orgs for each Salesforce DX project.

***

### Requirements <a href="#requirements" id="requirements"></a>

* A module registered in AutoRABIT – [learn how](https://knowledgebase.autorabit.com/~/revisions/woSPqiPyMz4Dlkp8971h/product-guides/arm/arm-features/salesforce-dx/create-a-module)

***

### Creating a New Scratch Org <a href="#creating-a-new-scratch-org" id="creating-a-new-scratch-org"></a>

1. **Open Scratch Org Management**\
   Hover over the **Salesforce DX** module and choose **Scratch Org Management**.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FyzgBdc2jbHdMwJv5WA1a%2Fimage.png?alt=media&#x26;token=6b98a9ab-5894-42c3-8cdf-6904109190a2" alt="Salesforce DX → Scratch Org Management tile" width="203"><figcaption></figcaption></figure>
2. **Start the wizard**\
   Click **Create Scratch Org**.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FoGkw02uZrcIChSSQjLNR%2Fimage.png?alt=media&#x26;token=5ee1c0f1-1877-4a28-8993-5b86f19e4771" alt="Create Scratch Org button"><figcaption></figcaption></figure>

***

#### Scratch Org Details <a href="#scratch-org-details" id="scratch-org-details"></a>

> **Tip:** Some objects depend on particular profiles or other metadata. Double-check dependencies before creating your org to avoid missing components.

Select a **Dev Hub** (your main [Salesforce Org](https://knowledgebase.autorabit.com/~/revisions/woSPqiPyMz4Dlkp8971h/product-guides/arm/registration/salesforce-org/salesforce-org-management)) and enter a **Scratch Org Name**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FuW54POeSfWMMvVVaHPCn%2Fimage.png?alt=media&#x26;token=47b27b25-c445-4a59-9474-5dca3cb685a9" alt="Dev Hub and Scratch Org name fields"><figcaption></figcaption></figure>

You can define the org in **three** ways:

1. **Template file** – Download the **ScratchOrg DefinitionTemplate**, edit locally, then upload.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F6x29bOxnFUHBhunYS1ck%2Fimage.png?alt=media&#x26;token=098e73b1-61e4-48e6-836d-a28d5b9678e8" alt="Download ScratchOrg Definition Template"><figcaption></figcaption></figure>
2. **Default values** – Skip uploading a file and fields; AutoRABIT builds the org with defaults (you’ll be prompted to confirm).

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FZZbGblJ90Relfo1zMdbK%2Fimage.png?alt=media&#x26;token=d9da0d2d-a4ca-4cd5-aa8b-8123bbb897c3" alt="Confirmation pop-up for default values"><figcaption></figcaption></figure>
3. **Manual entry** – Click **Input Details** and fill the form:

   * **Username** (email format; autogenerated if blank)
   * **Description**
   * **Duration Days** (active period)
   * **Organization** (business unit/name)
   * **Features** and **Preferences** (multi-select with Ctrl)
   * **Admin Email**, **Country**, **Language**
   * **Edition** (Developer, Enterprise, …)
   * **Wait Time** (1–15 min, default 6)

   Click **NEXT** when done.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FKv7ABGWOEDeAbDKGh5YG%2Fimage.png?alt=media&#x26;token=c224b09f-487c-40a2-9314-fee4b3e3e611" alt="Manual Scratch Org details form"><figcaption></figcaption></figure>

***

#### Select Module and Load Data <a href="#select-module-and-load-data" id="select-module-and-load-data"></a>

Choose your deployment source—**Salesforce Org**, **Version Control**, or an existing **Module**. (Need a new module? [Create one](https://knowledgebase.autorabit.com/~/revisions/woSPqiPyMz4Dlkp8971h/product-guides/arm/arm-features/salesforce-dx/create-a-module).)

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FJdKzncfioF85PhkMlaNs%2Fimage.png?alt=media&#x26;token=40cf4c86-c47a-474b-9d27-4e5e5814ef88" alt="Deployment source options"><figcaption></figcaption></figure>

***

**Deployment via Salesforce Org**

1. **Deployment From:** Salesforce Org
2. **Metadata Types:**
   * **Full Profiles** – all profiles in source
   * **Full Permission Sets** – all permission sets
   * **All** – every metadata type
3. **Source Org:** select org
4. **Deployment Method:**
   * **Selective Deployment** – choose specific types
   * **Full Deployment** – deploy everything
5. Click **Retrieve Metadata** and pick members (use **search** to filter).

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F9sfZTnPRSvqmVer5GyvV%2Fimage.png?alt=media&#x26;token=614b7283-585a-4303-a67f-7870a29f565b" alt="Retrieve Metadata listing"><figcaption></figcaption></figure>
6. Click **Proceed › Proceed** to open deployment filters.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FS1h9wqRsMhiENfT654bk%2Fimage.png?alt=media&#x26;token=27e28dc5-3759-45a8-8e9f-cedbd1ec07e7" alt="Deployment filter screen 1"><figcaption></figcaption></figure>

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FjrRP7cgFbBTR8jCwS5Wt%2Fimage.png?alt=media&#x26;token=faa87ae1-6e7d-45be-bc30-ebf05feaa0b0" alt="Deployment filter screen 2"><figcaption></figcaption></figure>
7. **Deployment Filters** include Ignore Warnings, Validate Only, Take Backup, etc.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>Note:</strong> <em>Standard fields</em> are <strong>not</strong> supported for <strong>Ignore Missing Visibility Settings</strong>.</p></div>
8. Optionally enable **Static Code Analysis**.
9. Apply **SEARCH / SUBSTITUTE** rules if configured.
10. Add **Deployment Notes**.
11. Click **Next** to view the **Deployment Summary** before execution.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fjh1LA6SBaMXzIZjIOpGJ%2Fimage.png?alt=media&#x26;token=4684afbd-649e-4930-8a37-63b8b84752cc" alt="Deployment Summary page"><figcaption></figcaption></figure>

***

**Deployment via Version Control**

1. **Deployment From:** Version Control
2. Choose **Version Control**, **Repository**, **Branch**.
3. Select **Metadata Types**.
4. Pick a **Deployment Method** and click **Retrieve Metadata** (steps 5–11 are identical to the Salesforce Org flow).

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FokHZH95GzgtdgcvwdB8t%2Fimage.png?alt=media&#x26;token=7762c5ff-a2e5-4a63-bbdf-d3df06bbe448" alt="Version Control deployment configuration"><figcaption></figcaption></figure>

***

**Deployment via Module**

Use an existing module in AutoRABIT:

* **Load Dataset from \<Module Name>** – adds the module’s dataset to the scratch org (if defined during module creation).
* **Include all dependent packages** – deploys every package linked to the module.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FlqQXj4PnmYVSaImPNO6K%2Fimage.png?alt=media&#x26;token=839ae963-67e3-4aeb-ade9-118d7fec7c2f" alt="Module deployment options"><figcaption></figcaption></figure>

Click **Show Members** to review metadata, then **Next** to continue to **Assign Branch and ALM**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FAJQWGaVszNF8D2BL4E3P%2Fimage.png?alt=media&#x26;token=7c4d410d-3307-4715-9a34-de0b64bcd47f" alt="Show Members list"><figcaption></figcaption></figure>

***

#### Assign Branch and ALM <a href="#assign-branch-and-alm" id="assign-branch-and-alm"></a>

**Assign Branch**

* Select **Version Control**, **Repository**, **Branch**.
* Use **Create Branch** to spin up a new branch for the scratch org.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FlXPYmo1bf27pwdfIsVvr%2Fimage.png?alt=media&#x26;token=655dc299-092c-4b8d-9f46-43055b73e413" alt="Assign Branch section"><figcaption></figcaption></figure>

**Assign User Story**

Link an ALM work item to track progress:

1. **ALM Type** (JIRA, Azure DevOps, etc.)
2. **ALM Label**
3. **Project** and **Sprint**
4. **Work Item**
5. Click **Next**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FdWGmvCVWn2DFVw9Fx0pk%2Fimage.png?alt=media&#x26;token=ea632da9-3668-4354-bf2b-53f8f94f1b52" alt="Assign ALM work item"><figcaption></figcaption></figure>

***

#### Manage Permissions <a href="#manage-permissions" id="manage-permissions"></a>

Assign module permissions to users; each receives an email with org details.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fbf3ayWkbDeZ7QplnzIyv%2Fimage.png?alt=media&#x26;token=6c2bccec-76f7-4a9f-9d24-2ed01558aa9b" alt="Manage Scratch Org permissions"><figcaption></figcaption></figure>

After submission you return to **Scratch Org Management** where progress is tracked.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FZnHhGhQ1338YMf2mJNoQ%2Fimage.png?alt=media&#x26;token=f88bad3a-6038-47b3-805b-3ddd1661d8dd" alt="Scratch Org Management list"><figcaption></figcaption></figure>

***

### Additional Options on the Scratch Org Management Screen <a href="#additional-options-on-scratch-org-management-screen" id="additional-options-on-scratch-org-management-screen"></a>

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fn1c2hnCOVnHxaIsMxcrA%2Fimage.png?alt=media&#x26;token=1e1598c1-dc04-458b-a633-d9ce0f526319" alt="Scratch Org Management actions"><figcaption></figcaption></figure>

1. **Scratch Org Summary** – click an org name for details.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FXAdUh0h2hqa6xyYEeWQW%2Fimage.png?alt=media&#x26;token=99ae8767-4fbb-49c3-a424-92eb829a27fe" alt="Scratch Org Summary page" width="563"><figcaption></figcaption></figure>
2. **View Log** – see log output.
3. **Deployment Status & Report** – success, failure, timeout, etc.
4. **Load Data** – shows whether sample data was added.
5. **Scratch Org Status** – active / inactive.
6. **Manage**
   * **Launch Scratch Org** – opens the org in a new tab (allow pop-ups).
   * **Manage Scratch Org Permissions** – update user access (emails sent on change).
7. **Actions**
   * **Delete Scratch Org** – permanent deletion.
   * **Edit ALM and Branch** – change ALM link or VCS branch.

***
