# Migrate Custom Function from Sandbox to Production by Using a DevOps Data Kit

Use a DevOps data kit to move custom function deployments from sandbox to production after you validate chunking behavior in a sandbox. You can migrate in one of these ways:

- Move only the custom function deployment, and then create a new search index in production that uses the migrated function.
- Move the search index, custom function deployment, and required dependencies together in the same migration package.

| Edition Table                                                                                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Available in: **Developer**, **Enterprise**, **Performance**, and **Unlimited** Editions. See [Data 360 edition availability](https://help.salesforce.com/s/articleView?id=sf.c360_a_dc_editions.htm&type=5). |

| User Permissions Needed                                            |                                                        |
| ------------------------------------------------------------------ | ------------------------------------------------------ |
| To migrate custom function deployments from sandbox to production: | Permission set: <ul><li>Data Cloud Architect</li></ul> |

## Prerequisites

1. Access both sandbox and production Data 360 orgs, with required permissions in both environments.

2. Enable Code Extension in Data Cloud Setup by using Feature Manager. See [Enable Data 360 Features in Feature Manager](https://help.salesforce.com/s/articleView?id=data.c360\_a_feature_manager.htm\&language=en_US\&type=5).

3. Validate your custom function deployment in sandbox before migration. See [Use a Custom Chunking Function in a Search Index](/docs/data/data-cloud-code-ext/guide/use-chunking-in-search-index.md) and [Verify Custom Chunking Results](/docs/data/data-cloud-code-ext/guide/verify-chunking-results.md).

## Step 1: Create a DevOps Data Kit

1. In your sandbox org, go to **Data Cloud Setup**.
2. Under **Developer Tools**, click **Data Kits**.
3. Click **New**.
4. For **Data Kit Type**, select **DevOps**.
5. Name the data kit, add an optional description, and save.

## Step 2: Add Components to the Data Kit

Choose the components based on your migration path:

- To move only the function deployment, click **Add** next to **Data Custom Codes**, select your custom function deployment, and click **Save**.
- To move the search index, function, and dependencies together, add all of these components:
  - **Data Custom Codes**: your custom function deployment.
  - **Search Index**: the search index that uses your custom function.
  - Any required dependencies referenced by the search index configuration.

## Step 3: Review and Publish the Data Kit

1. Review the component list and confirm that all required dependencies are included.
2. Click **Publish**.

## Step 4: Add the Data Kit to a Package

For detailed instructions, see [Add the Data Kit to a Package](https://help.salesforce.com/s/articleView?id=data.c360\_a_publish_package_kit.htm\&type=5).

## Step 5: Deploy the Data Kit to Production

1. In your production org, go to **Data Cloud Setup**, and click **Data Kits**.
2. Open your data kit, and click **Data Kit Deploy**.
3. Select a data space, provide connection org details for the data bundle, and click **Deploy**.
4. Check **Deployment History** to monitor progress and confirm completion.

## Step 6: Create or Verify the Search Index in Production

- If you migrated only the function deployment, create a new search index in production by using Advanced Setup, set Chunking Strategy to **Code Extension**, and select the migrated function deployment.
- If you migrated the search index with the function and dependencies, verify that the migrated search index is available and uses the expected custom function configuration.

## Next Step

- [Use a Custom Chunking Function in a Search Index](/docs/data/data-cloud-code-ext/guide/use-chunking-in-search-index.md)
- [Verify Custom Chunking Results](/docs/data/data-cloud-code-ext/guide/verify-chunking-results.md)
