> For the complete documentation index, see [llms.txt](https://knowledgebase.autorabit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.autorabit.com/product-guides/guard/getting-started-with-guard/refreshing-a-salesforce-sandbox.md).

# Refreshing a Salesforce Sandbox

#### Take care when refreshing a Sandbox org

A full Salesforce sandbox refresh creates a new Org ID, so Guard cannot re-link the existing connection. Plan before refresh to reduce instability and configuration loss.

#### Before the refresh

1. Export or document your policies
   * Record policy name, scope, rules and notification settings
   * Use `guard get baseline-policy` and `guard get policy-intent` to capture definitions programmatically using the Guard CLI
2. Export any historical data you need to retain
3. Note the Guard connection details
   * Org display name, purpose, enabled features, connection type (OAuth vs External Client App)
   * Login URL and connected user
4. Do not delete the Guard org entry yet
   * Deletion is irreversible for Guard-held data
   * Keep the entry until you are ready to reconnect

#### During the refresh

Complete the Salesforce sandbox refresh as normal. Expect a new Salesforce Org ID when the refresh finishes.

#### After the refresh: reconnecting in Guard

Step 1 — Wait before making changes

Allow 15–30 minutes after the Salesforce refresh completes before modifying Guard connections. This gives async cleanup and sync jobs time to settle if a prior delete was attempted.

Step 2 — Choose your path

| Scenario                          | Action                                                                                                 |
| --------------------------------- | ------------------------------------------------------------------------------------------------------ |
| Token expired only, same Org ID   | Use Reauthenticate on the org detail page                                                              |
| Full sandbox refresh (new Org ID) | Delete old entry, then register refreshed sandbox                                                      |
| Unsure                            | Check Salesforce Setup → Company Information for the Org ID. If it changed, you must delete and re-add |

Step 3 — Delete the old Guard entry (if Org ID changed)

1. Open Salesforce Orgs → select the pre-refresh org
2. Review the delete warning and confirm you have documented policies
3. Click Delete Org
4. Wait for the success toast before proceeding

Step 4 — Register the refreshed sandbox

1. Add a new Salesforce org connection with the same display name and purpose as before
2. Complete OAuth or External Client App authentication against the refreshed sandbox
3. Enable the same Guard features (Change Monitoring, Permission Explorer, etc.)

Step 5 — Recreate configuration

| Configuration                        | How to restore                                                     |
| ------------------------------------ | ------------------------------------------------------------------ |
| Authorization policies               | Recreate manually, or via Guard CLI `admin baseline-policy create` |
| Change Monitoring notification rules | Recreate, or apply from template                                   |
| Permission Explorer queries          | Recreate saved queries                                             |

#### What cannot be transferred today

* Change Monitoring historical records
* Authorization Policy violation history
* Classification analysis history
* Any other data tied to the pre-refresh Guard identification

Policies can be recreated with the same rules, but they are new objects linked to the new Guard identification.

#### Reducing post-refresh instability

* Avoid deleting and immediately re-adding multiple orgs in quick succession
* Complete one org reconnect before starting the next
* If the Salesforce Orgs page hangs, wait 30 minutes and retry
* Ensure only one admin performs the delete/re-add


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://knowledgebase.autorabit.com/product-guides/guard/getting-started-with-guard/refreshing-a-salesforce-sandbox.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
