---
schema_version: "1"
id: ea9c73d149adc330c7d204dcef87fd1ec97f5288496dc6ccfe4ec51d947520bd
title: Schedule Reorganization
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/cgtpm_schedule_reorganization.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_reorganization.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: c01965158c2e3bd8314f46ebde0a2cdc0384f2e7c3cdcf66549bcafda43eaeb3
description: Performs off-platform data cleanup and reorganization. Promotions in Salesforce that are deleted, inactive, or cancelled are removed from off-platform data. Additionally, softly deleted measure data is hard deleted.
---
# Schedule Reorganization

Performs off-platform data cleanup and reorganization. Promotions in Salesforce that are deleted, inactive, or cancelled are removed from off-platform data. Additionally, softly deleted measure data is hard deleted.

![Note](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/images/icon_note.png)

#### Note

It is recommended that this request must be run as the first step in the nightly batch chain.

![Note](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/images/icon_note.png)

#### Note

The Schedule Reorganization endpoint performs data cleanup. The jobThreads parameter is not effective for this endpoint.

## Resource

SCHEDULE\_REORGANIZATION

## Available version

55.0

## Apex Request Example

String endpointName = 'SCHEDULE\_REORGANIZATION';
String jobName = 'Reorg';
String salesOrg = '0001'; // Sales Organization name
<namespace>.OffPlatformCallout request = new <namespace>.OffPlatformCallout(endpointName, salesOrg);
<namespace>.OffplatformCalloutResponse response = request.execute(
    <namespace>.TransactionHandler.getTransactionIdentifier(), 
    new Map<String,String\>(), 
    JSON.serialize(
        new Map<String, Object\>{
            'jobname' => jobName, 
            'salesorg' => salesOrg,
            'batchchain' =>  String.format(
                'TPM\_Calculation\_Chain\_{0}\_{1}',
                new List<String\>{
                    salesOrg,
                    System.now().format('YYYYMMdd\_hhmmss')
                }
            ),
            'jobthreads' => 1
        }
    )
);
if (response.status != 200) {
    //Handle errors
}