---
schema_version: "1"
id: 08fbeb704a9c3fca5e2895ce0d4896b618d6f0227389223f7726fa28a57880e2
title: Customize the Promotion Transfer Process
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/promotion_transfer_apex_setup.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/promotion_transfer_apex_setup.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: ec35174dd3fa552d8e3541a7cd8371a042e9dfa7f85432c652db7208f656fad7
description: To modify the promotion details being transferred, create a callable Apex class as a customization hook.
---
# Customize the Promotion Transfer Process

To modify the promotion details being transferred, create a callable Apex class as a customization hook.

1. Log in to your Salesforce org, and go to Developer Console.
2. Create a global Apex class that implements the System.Callable interface.
3. Override the global call method that has these parameters.
    
    - action: String. The behavior for the method to exhibit.
    - params: Map<String,Object>. Arguments to be used by the specified action. The object is of type List<RE\_PromotionTransfer\>. The RE\_PromotionTransfer class exposes methods to access the promotion. For a list of all the exposed methods, see [RE\_PromotionTransfer Class Reference](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/RE_promotion_transfer_class.htm "The RE_PromotionTransfer Apex class provides programmatic access to the RE_PromotionTransfer sObject and its related sObjects.").
    
    Here’s the Apex class structure.
    
    global class <Your Callable APEX Class> implements System.Callable {
    
        global Object call(String action, Map<String, Object> params) {
            // Get the RE\_PromotionTransfer instances from the arguments
            List<cgcloud.RE\_PromotionTransfer> promotionTransferWrapper = (List<cgcloud.RE\_PromotionTransfer>) params.get('promotionTransfer');
            // Your custom logic goes here
            return promotionTransferWrapper;
        }
    }
4. To modify the promotion fields, use the methods exposed by the RE\_PromotionTransfer class.
    
    Add your customizations in the Apex class to:
    
    - Create promotion records.
    - Modify and delete existing promotion records.
    
    Here’s a sample Apex class that adds a new promotion sObject record during the promotion save process.
    
    global class PromotionTransferSaveCust implements System.Callable {
        global Object call(String action, Map < String, Object > params) {
            // Get the List of RE\_PromotionTransfer instances
            List < cgcloud.RE\_PromotionTransfer > promotionTransferWrapperList = (List < cgcloud.RE\_PromotionTransfer > ) params.get('promotionTransfer');
            //Get the first Promotion Record from the wrapper
            cgcloud\_\_Promotion\_\_c record = (cgcloud\_\_Promotion\_\_c) promotionTransferWrapper\[0\].getPromotion().getRecord();
    
            List < cgcloud\_\_Promotion\_\_c > promotionList = new List < cgcloud\_\_Promotion\_\_c > ();
    
            for (Integer count = 0; count < 1; count++) {
                cgcloud\_\_Promotion\_\_c newPromotion = new cgcloud\_\_Promotion\_\_c();
                newPromotion.cgcloud\_\_Slogan\_Language\_1\_\_c = record.cgcloud\_\_Slogan\_Language\_1\_\_c + count;
                promotionList.add(newPromotion);
                newPromotion.cgcloud\_\_Promotion\_Template\_\_c = 'a2X8D0000003NHQUA2'; //Update the new promotion with the target Promotion Template
                newPromotion.cgcloud\_\_Date\_From\_\_c = Date.newInstance(2023, 9, 9);
                newPromotion.cgcloud\_\_Date\_Thru\_\_c = Date.newInstance(2023, 9, 12);
                newPromotion.RecordTypeId = '0128D000002MRKEQA4'; //Update the new promotion with the correct Record Type ID
                promotionTransferWrapper.add(new cgcloud.RE\_PromotionTransfer(newPromotion));
            }
            return promotionTransferWrapper;
        }
    }
    
    For use cases related to the promotion and tactic transfer process customization, see [Promotion and Tactic Transfer Customization Use Cases](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/tactic_transfer_apex_save_customization.htm "This section provides different Apex customization use cases for the promotion and tactic transfer process.").
5. From Setup, in the Quick Find box, enter Custom Metadata Types, and then expand **Custom Metadata Types**.
6. On the **CGCloud Process Customization** row, click **Manage Records**.
7. Click **New**, fill in these details, and then save your work.
    
    - **Label**: RE\_Promotion\_Transfer\_Save
    - **DeveloperName**: RE\_Promotion\_Transfer\_Save
    - **Class**: <Your Callable APEX Class>
    - **Method**: save
    - **Enabled**: Select the checkbox.

The Apex customization hook is enabled. When a planned promotion is saved in TPM, the call method modifies the existing promotion. Or it adds a promotion record based on your custom logic before transferring it to RE, where the promotion becomes sellable.

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

#### Note

The transfer of custom attributes is supported only for advanced promotion, tactic, and tactic product objects.