---
schema_version: "1"
id: 1b2fa4495c8737b639d25e170da156285030d2fe443326aedfd1339b88ecd542
title: Promotion Wizards & Customization
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/new_promotion_wizard_default.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/new_promotion_wizard_default.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5fc83051426857dc24e49ad8d585ec1f871ff8d984cd3f918b980c2a96ee8504
description: Wizards related to promotions are implemented using Metadata Wizard and Business Object API.
---
# Promotion Wizards & Customization

Wizards related to promotions are implemented using Metadata Wizard and Business Object API.

When a user launches a wizard for a promotion, the MetadataWizard configuration for this user is used to display the required options in the user interface. When the user submits the wizard, the payload generated is submitted to the relevant Business Object API workflow for processing.

- When new promotion option is selected from Trade Planning, Account Plan, or Promotion List, the NewPromotion configuration is used. When the wizard is submitted, the Create workflow is triggered through Business Object API.
- When copy option is selected from Trade Planning or Promotion List, the CopyPromotion configuration is used. When the wizard is submitted, the Copy workflow is triggered through Business Object API.
- When derive option is selected from Trade Planning or Promotion List, the DerivePromotion configuration is used. When the wizard is submitted, the Derive workflow is triggered through Business Object API.

## Installing and Updating Base Configuration Records

To install or update base configuration records, execute the following commands in APEX console:cgcloud.TPMSetupData.setupMetadataWizard('<sales org>'); cgcloud.TPMSetupData.setupBOApi('<sales org>');

These commands create and update MetadataWizard configuration records and Business Object API configuration records to the provided values by Consumer Goods Cloud TPM for the salesorg.

## Base MetadataWizard Configurations

A few records are required for the Metadata Wizard Configurations to work as designed. These records provide a customizable configuration for multiple wizards used for managing TPM use cases. Each of these configuration is required for each sales org. They’re created by running the APEX code snippet provided in Installing and Updating Base Configuration Records.

**NewPromotion**

{
  "size": "medium",
  "title": "{! $Label.cgcloud\_\_NPW\_NEW + ' ' + $SObjectType.cgcloud\_\_Promotion\_\_c.label}",
  "columns": 2,
  "components": \[
    {
      "id": "promoSlogan",
      "type": "Text",
      "outputProperty": "Slogan",
      "required": true,
      "label": "{! $SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Slogan\_\_c.label }",
      "maxLength": 80,
      "defaultValue": "{! \_input\_.Slogan }"
    },
    {
      "id": "promoTemplate",
      "type": "Picklist",
      "required": true,
      "outputProperty": "PromotionTemplate",
      "source": {
        "class": "NewPromotionWizardCallable",
        "method": "getPromotionTemplates",
        "cache": true,
        "params": {}
      },
      "label": "{! $SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Promotion\_Template\_\_c.label }",
      "autoSelectFirstItem": true,
      "defaultValue": "{! \_input\_.PromotionTemplate}"
    },
    {
      "id": "promoAnchorAccount",
      "type": "Picklist",
      "active": "{! promoTemplate.AnchorType == 'Customer' }",
      "visible": "{! promoTemplate.AnchorType == 'Customer' }",
      "required": true,
      "outputProperty": "AnchorAccount",
      "source": {
        "class": "NewPromotionWizardCallable",
        "method": "getAccounts",
        "cache": true,
        "params": {
          "dateFrom": "{! promoDateFrom }",
          "dateThru": "{! promoDateThru }"
        }
      },
      "label": "{! $SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Anchor\_Account\_\_c.label }",
      "autoSelectFirstItem": true,
      "defaultValue": "{! \_input\_.AnchorAccount}"
    },
    {
      "id": "promoAnchorAccountSet",
      "type": "Picklist",
      "active": "{! promoTemplate.AnchorType == 'CustomerSet' }",
      "visible": "{! promoTemplate.AnchorType == 'CustomerSet' }",
      "required": true,
      "outputProperty": "AnchorAccountSet",
      "source": {
        "class": "NewPromotionWizardCallable",
        "method": "getAccountSets",
        "cache": true,
        "params": {
          "dateFrom": "{! promoDateFrom }",
          "dateThru": "{! promoDateThru }"
        }
      },
      "label": "{! $SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Anchor\_Account\_Set\_\_c.label }",
      "autoSelectFirstItem": true,
      "defaultValue": "{! \_input\_.AnchorAccountSet }"
    },
    {
      "id": "promoNoAnchor",
      "type": "Empty",
      "visible": "{! promoTemplate.AnchorType == null }"
    },
    {
      "type": "Picklist",
      "id": "productPicklist",
      "label": "{! $SObjectType.Product2.fields.cgcloud\_\_Criterion\_3\_Product\_\_c.label }",
      "active": "{! promoTemplate.ProductDefinitionLevel == 'Promotion' }",
      "visible": "{! promoTemplate.ProductDefinitionLevel == 'Promotion' }",
      "source": {
        "class": "NewPromotionWizardCallable",
        "method": "getProducts",
        "params": {
          "level": "Brand",
          "dateFrom": "{! promoDateFrom }",
          "dateThru": "{! promoDateThru }",
          "promotionTemplate": "{! promoTemplate.Id }",
          "accountOrAccountSet": "{! if(promoTemplate.AnchorType, if(promoTemplate.AnchorType == 'CustomerSet', promoAnchorAccountSet.Id, promoAnchorAccount.Id), '') }"
        },
        "cache": true
      },
      "multiselect": true,
      "defaultValue": "{! \_input\_.criterion\_3\_product\_\_c }",
      "outputProperty": "ProductFilter.Criteria.Brand"
    },
    {
      "id": "promoNoProduct",
      "type": "Empty",
      "visible": "{! promoTemplate.ProductDefinitionLevel != 'Promotion' }"
    },
    {
      "id": "promoDateFrom",
      "type": "Date",
      "label": "{!$SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Placement\_Date\_From\_\_c.label}",
      "outputProperty": "DateFrom",
      "required": true,
      "defaultValue": "{! \_input\_.initialDate || 'today' }"
    },
    {
      "id": "promoDateThru",
      "type": "Duration",
      "referenceDate": "{! promoDateFrom }",
      "required": true,
      "label": "{! $Label.cgcloud\_\_NPW\_DURATION }",
      "outputProperty": "DateThru",
      "defaultValue": {
        "metric": "week",
        "quantity": 3
      }
    },
    {
      "id": "promoManualInputController",
      "type": "ListController",
      "label": "{! $Label.cgcloud\_\_NPW\_KPI }",
      "outputProperty": "ManualInputs",
      "maxItems": "{! promoTemplate.NumberOfPromotionKPIs }",
      "active": "{! promoTemplate.NumberOfPromotionKPIs }",
      "defaultItems": "{! promoTemplate.NumberOfPromotionKPIs }",
      "visible": "{! promoTemplate.NumberOfPromotionKPIs }",
      "itemUniqueKey": "{! promoKPI.Id }",
      "columns": 2,
      "components": \[
        {
          "id": "promoKPI",
          "label": "{! $Label.cgcloud\_\_NPW\_KPI }",
          "type": "Picklist",
          "required": true,
          "source": {
            "class": "NewPromotionWizardCallable",
            "method": "getPromotionKPIs",
            "params": {
              "promoTemplate": "{! promoTemplate.Id }"
            },
            "cache": true
          },
          "outputProperty": "KPI",
          "autoSelectFirstItem": true,
          "defaultValueIndex": "{! \_idx\_ }"
        },
        {
          "id": "promoKPIValue",
          "label": "{! $Label.cgcloud\_\_VALUE}",
          "type": "Number",
          "required": true,
          "outputProperty": "Value",
          "decimalPlaces": "{! promoKPI.ValueDecimalPlaces }"
        }
      \]
    },
    {
      "id": "TacticController",
      "type": "ListController",
      "label": "{! $SObjectType.cgcloud\_\_Tactic\_\_c.pluralLabel }",
      "outputProperty": "Tactics",
      "maxItems": 10,
      "active": "{! promoTemplate.HasTacticTemplates }",
      "visible": "{! promoTemplate.HasTacticTemplates }",
      "defaultItems": 1,
      "columns": 3,
      "components": \[
        {
          "id": "tacticTemplate",
          "type": "Picklist",
          "required": true,
          "outputProperty": "TacticTemplate",
          "source": {
            "class": "NewPromotionWizardCallable",
            "method": "getTacticTemplates",
            "params": {
              "promoTemplate": "{! promoTemplate.Id }"
            },
            "cache": true
          },
          "label": "{! $SObjectType.cgcloud\_\_Tactic\_\_c.fields.cgcloud\_\_Tactic\_Template\_\_c.label }",
          "defaultValueIndex": "{! \_idx\_ }",
          "autoSelectFirstItem": true
        },
        {
          "id": "tacticKPIValue",
          "type": "Number",
          "label": "{! tacticKPIName.Name }",
          "required": false,
          "outputProperty": "ManualInputs\[0\].Value",
          "visible": "{! tacticKPIName.Id }",
          "active": "{! tacticKPIValue != null || tacticKPIValue == 0 }",
          "decimalPlaces": "{! tacticKPIName.ValueDecimalPlaces }"
        },
        {
          "id": "tacticKPIName",
          "type": "Picklist",
          "label": "{! $Label.cgcloud\_\_NPW\_KPI }",
          "visible": false,
          "active": "{! tacticKPIValue != null || tacticKPIValue == 0 }",
          "source": {
            "class": "NewPromotionWizardCallable",
            "method": "getTacticKPIs",
            "params": {
              "promoTemplate": "{! promoTemplate.Id }",
              "tacticTemplate": "{! tacticTemplate.Id }"
            },
            "cache": true
          },
          "outputProperty": "ManualInputs\[0\].KPI",
          "autoSelectFirstItem": true
        },
        {
          "id": "tacticCompensationModel",
          "type": "Picklist",
          "required": true,
          "outputProperty": "CompensationModel",
          "source": {
            "class": "NewPromotionWizardCallable",
            "method": "getTacticCompensationModels",
            "params": {
              "tacticTemplate": "{! tacticTemplate.Id }"
            },
            "cache": true
          },
          "label": "{! $SObjectType.cgcloud\_\_Tactic\_\_c.fields.cgcloud\_\_Compensation\_Model\_\_c.label }",
          "autoSelectFirstItem": true
        }
      \]
    }
  \],
  "footerLeftButtons": \[
    "cancel"
  \],
  "footerRightButtons": \[
    {
      "type": "saveAndCopy",
      "brand": "neutral",
      "label": "{! $Label.cgcloud\_\_NPW\_BTN\_SAVE\_AND\_COPY }"
    },
    {
      "type": "saveAndEdit",
      "brand": "neutral",
      "label": "{! $Label.cgcloud\_\_NPW\_BTN\_SAVE\_AND\_EDIT }"
    },
    {
      "type": "submit",
      "brand": "brand",
      "label": "{! $Label.cgcloud\_\_NPW\_BTN\_SAVE }"
    }
  \]
}

**CopyPromotion**

{
  "size": "small",
  "title": "{! $Label.cgcloud\_\_PC\_BTN\_COPY + ' ' + $SObjectType.cgcloud\_\_Promotion\_\_c.label}",
  "columns": 1,
  "context": \[
    {
      "id": "promotionData",
      "source": {
        "class": "CopyPromotionWizardCallable",
        "method": "getPromotion",
        "cache": false,
        "params": {
          "promotionId": "{! \_input\_.promotionId }",
          "fields": \[
            "Id",
            "cgcloud\_\_Slogan\_\_c",
            "cgcloud\_\_Placement\_Date\_From\_\_c",
            "cgcloud\_\_Anchor\_Account\_\_c",
            "cgcloud\_\_Anchor\_Account\_Set\_\_c",
            "cgcloud\_\_Promotion\_Template\_\_r.cgcloud\_\_Anchor\_Type\_\_c"
          \]
        }
      }
    }
  \],
  "components": \[
    {
      "id": "promotionId",
      "type": "Computed",
      "outputProperty": "Id",
      "value": "{! promotionData.Id }"
    },
    {
      "id": "promoSlogan",
      "type": "Text",
      "outputProperty": "Slogan",
      "required": true,
      "label": "{! $SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Slogan\_\_c.label }",
      "maxLength": 80,
      "defaultValue": "{! promotionData.cgcloud\_\_Slogan\_\_c }"
    },
    {
      "id": "promoDateFrom",
      "type": "Date",
      "label": "{!$SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Placement\_Date\_From\_\_c.label}",
      "outputProperty": "InStoreDateFrom",
      "required": true,
      "defaultValue": "{! promotionData.cgcloud\_\_Placement\_Date\_From\_\_c || 'today' }"
    },
    {
      "id": "promoAnchorAccount",
      "type": "Picklist",
      "active": "{! promotionData.cgcloud\_\_Promotion\_Template\_\_r.cgcloud\_\_Anchor\_Type\_\_c == 'Customer' }",
      "visible": "{! promotionData.cgcloud\_\_Promotion\_Template\_\_r.cgcloud\_\_Anchor\_Type\_\_c == 'Customer' }",
      "outputProperty": "AnchorAccount",
      "source": {
        "class": "CopyPromotionWizardCallable",
        "method": "getAccounts",
        "cache": true,
        "params": {
          "promotionId": "{! promotionId }",
          "inStoreDateFrom": "{! promoDateFrom }"
        }
      },
      "label": "{! $SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Anchor\_Account\_\_c.label }",
      "autoSelectFirstItem": true,
      "defaultValue": "{! promotionData.cgcloud\_\_Anchor\_Account\_\_c }"
    },
    {
      "id": "promoAnchorAccountSet",
      "type": "Picklist",
      "active": "{! promotionData.cgcloud\_\_Promotion\_Template\_\_r.cgcloud\_\_Anchor\_Type\_\_c == 'CustomerSet' }",
      "visible": "{! promotionData.cgcloud\_\_Promotion\_Template\_\_r.cgcloud\_\_Anchor\_Type\_\_c == 'CustomerSet' }",
      "required": true,
      "outputProperty": "AnchorAccountSet",
      "source": {
        "class": "CopyPromotionWizardCallable",
        "method": "getAccountSets",
        "cache": true,
        "params": {
          "promotionId": "{! promotionId }",
          "inStoreDateFrom": "{! promoDateFrom }"
        }
      },
      "label": "{! $SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Anchor\_Account\_Set\_\_c.label }",
      "autoSelectFirstItem": true,
      "defaultValue": "{! promotionData.cgcloud\_\_Anchor\_Account\_Set\_\_c }"
    },
    {
      "id": "promoNoAnchor",
      "type": "Empty",
      "visible": "{! promotionData.cgcloud\_\_Promotion\_Template\_\_r.cgcloud\_\_Anchor\_Type\_\_c == null }"
    },
    {
      "id": "copyAttachments",
      "type": "Checkbox",
      "outputProperty": "CopyAttachments",
      "label": "{! $Label.cgcloud\_\_PC\_LBL\_COPY\_ATTACHMENTS }"
    }
  \],
  "footerLeftButtons": \[
    "cancel"
  \],
  "footerRightButtons": \[
    {
      "type": "saveAndCopy",
      "brand": "neutral",
      "label": "{! $Label.cgcloud\_\_NPW\_BTN\_SAVE\_AND\_COPY }"
    },
    {
      "type": "saveAndEdit",
      "brand": "neutral",
      "label": "{! $Label.cgcloud\_\_NPW\_BTN\_SAVE\_AND\_EDIT }"
    },
    {
      "type": "submit",
      "brand": "brand",
      "label": "{! $Label.cgcloud\_\_NPW\_BTN\_SAVE }"
    }
  \]
}

**DerivePromotion**

{
  "size": "small",
  "title": "{! $Label.cgcloud\_\_PC\_BTN\_DERIVE + ' ' + $SObjectType.cgcloud\_\_Promotion\_\_c.label}",
  "columns": 1,
  "context": \[
    {
      "id": "promotionData",
      "source": {
        "class": "CopyPromotionWizardCallable",
        "method": "getPromotion",
        "cache": false,
        "params": {
          "promotionId": "{! \_input\_.promotionId }",
          "fields": \[
            "Id",
            "cgcloud\_\_Placement\_Date\_From\_\_c"
          \]
        }
      }
    }
  \],
  "components": \[
    {
      "id": "promotionId",
      "type": "Computed",
      "outputProperty": "Id",
      "value": "{! promotionData.Id }"
    },
    {
      "id": "promoTemplate",
      "type": "Picklist",
      "required": true,
      "outputProperty": "PromotionTemplate",
      "source": {
        "class": "DerivePromotionWizardCallable",
        "method": "getPromotionTemplates",
        "cache": true,
        "params": {
          "promotionId": "{! promotionData.Id }"
        }
      },
      "label": "{! $SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Promotion\_Template\_\_c.label }",
      "autoSelectFirstItem": true
    },
    {
      "id": "promoDateFrom",
      "type": "Date",
      "label": "{!$SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Placement\_Date\_From\_\_c.label}",
      "outputProperty": "InStoreDateFrom",
      "required": true,
      "defaultValue": "{! promotionData.cgcloud\_\_Placement\_Date\_From\_\_c || 'today' }"
    },
    {
      "id": "promoAnchorAccount",
      "type": "Picklist",
      "active": true,
      "visible": true,
      "required": true,
      "outputProperty": "AnchorAccount",
      "source": {
        "class": "DerivePromotionWizardCallable",
        "method": "getAccounts",
        "cache": true,
        "params": {
          "promotionId": "{! promotionData.Id }",
          "inStoreDateFrom": "{! promoDateFrom }"
        }
      },
      "label": "{! $SObjectType.cgcloud\_\_Promotion\_\_c.fields.cgcloud\_\_Anchor\_Account\_\_c.label }",
      "autoSelectFirstItem": true
    },
    {
      "id": "deriveAttachments",
      "type": "Checkbox",
      "outputProperty": "DeriveAttachments",
      "label": "{! $Label.cgcloud\_\_PC\_LBL\_DERIVE\_ATTACHMENTS }"
    }
  \],
  "footerLeftButtons": \[
    "cancel"
  \],
  "footerRightButtons": \[
    {
      "type": "saveAndCopy",
      "brand": "neutral",
      "label": "{! $Label.cgcloud\_\_NPW\_BTN\_SAVE\_AND\_COPY }"
    },
    {
      "type": "saveAndEdit",
      "brand": "neutral",
      "label": "{! $Label.cgcloud\_\_NPW\_BTN\_SAVE\_AND\_EDIT }"
    },
    {
      "type": "submit",
      "brand": "brand",
      "label": "{! $Label.cgcloud\_\_NPW\_BTN\_SAVE }"
    }
  \]
}

- **[New Promotion Wizard Invocable Actions](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/rcg_tpm_new_promotion_apex_wrapper.htm)**  
    This class contains support for Data Source providers used in the NewPromotion wizard.
- **[Copy Promotion Wizard Invocable Actions](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/rcg_tpm_copy_promotion_apex_wrapper.htm)**  
    This class contains support for Data Source providers used in the CopyPromotion wizard.
- **[Derive Promotion Wizard Invocable Actions](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/rcg_tpm_derive_promotion_apex_wrapper.htm)**  
    This class contains support for Data Source providers used in the DerivePromotion wizard.