---
schema_version: "1"
id: 668ae59a1fdd3ffb1aa85585e74cff4f75c905b73b6863a030602b84062a4b08
title: Update Promotion
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/cgtpm_update_promotion.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_update_promotion.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 56fab6379cd5587558d03c9bd0ab3187dc0bfa399eaacc3c77b9a63a9c2e5f61
description: Updates the details of a given promotion in the promotion cache (without calculation).
---
# Update Promotion

Updates the details of a given promotion in the promotion cache (without calculation).

Soft limits:

- Maximum number of products managed by promotion is based on PromotionMaxManagedProducts. Default value is 900.

## Resource

UPDATE\_PROMOTION

## Available version

55.0

## Apex Request Example

String salesOrg = '0001';
String endpointName = 'UPDATE\_PROMOTION';
Id promoId = 'promotionId';
cgcloud\_\_Promotion\_\_c promo = \[SELECT Id, cgcloud\_\_Anchor\_Account\_\_c, cgcloud\_\_Date\_From\_\_c, cgcloud\_\_Date\_Thru\_\_c, cgcloud\_\_Delivery\_Date\_From\_\_c, cgcloud\_\_Delivery\_Date\_Thru\_\_c, cgcloud\_\_Placement\_Date\_From\_\_c, cgcloud\_\_Placement\_Date\_Thru\_\_c, cgcloud\_\_Commit\_Date\_\_c, cgcloud\_\_Promotion\_Template\_\_c FROM cgcloud\_\_Promotion\_\_c WHERE Id=:promoId LIMIT 1\];
String payload = JSON.serialize(new Map<String, Object\>{
    'promotionid'\=>promo.Id,
    'phase'\=>'Planning',
    'active'\=>true,
    'version'\=>2,
    'isfrozen'\=>false,
    'accoundsetid'\=>null,
    'accountid'\=>promo.cgcloud\_\_Anchor\_Account\_\_c,
    'commitdate'\=>Datetime.newInstanceGmt(promo.cgcloud\_\_cgcloud\_\_Commit\_Date\_\_c.year(), promo.cgcloud\_\_cgcloud\_\_Commit\_Date\_\_c.month(), promo.cgcloud\_\_cgcloud\_\_Commit\_Date\_\_c.day()).getTime(),
    'datefrom'\=>Datetime.newInstanceGmt(promo.cgcloud\_\_cgcloud\_\_Date\_From\_\_c.year(), promo.cgcloud\_\_Date\_From\_\_c.month(), promo.cgcloud\_\_Date\_From\_\_c.day()).getTime(),
    'datethru'\=>Datetime.newInstanceGmt(promo.cgcloud\_\_Date\_Thru\_\_c.year(), promo.cgcloud\_\_Date\_Thru\_\_c.month(), promo.cgcloud\_\_Date\_Thru\_\_c.day()).getTime(),
    'manualcalculationinput'\=>new Map<String, Object\>(),
    'instoredatefrom'\=>Datetime.newInstanceGmt(promo.cgcloud\_\_Placement\_Date\_From\_\_c.year(), promo.cgcloud\_\_Placement\_Date\_From\_\_c.month(), promo.cgcloud\_\_Placement\_Date\_From\_\_c.day()).getTime(),
    'instoredatethru'\=>Datetime.newInstanceGmt(promo.cgcloud\_\_Placement\_Date\_Thru\_\_c.year(), promo.cgcloud\_\_Placement\_Date\_Thru\_\_c.month(), promo.cgcloud\_\_Placement\_Date\_Thru\_\_c.day()).getTime(),
    'shipmentdatefrom'\=>Datetime.newInstanceGmt(promo.cgcloud\_\_Delivery\_Date\_From\_\_c.year(), promo.cgcloud\_\_Delivery\_Date\_From\_\_c.month(), promo.cgcloud\_\_Delivery\_Date\_From\_\_c.day()).getTime(),
    'shipmentdatethru'\=>Datetime.newInstanceGmt(promo.cgcloud\_\_Delivery\_Date\_Thru\_\_c.year(), promo.cgcloud\_\_Delivery\_Date\_Thru\_\_c.month(), promo.cgcloud\_\_Delivery\_Date\_Thru\_\_c.day()).getTime(),
    'promotiontemplateid'\=>promo.cgcloud\_\_Promotion\_Template\_\_c,
    'salesorg'\=>salesOrg,
    'aggregationcategory'\=>null,
    'calculationmode' => 'Writeback',
    'firstdayofweek' => 1,
    'firstweekofyear' => 1,
    'productgrouplevels' => new List<String\>{'Category'}
});
<namespace>.OffPlatformCallout request = new <namespace>.OffPlatformCallout(endpointName, salesOrg);
<namespace>.OffPlatformCalloutResponse response = request.execute(
    <namespace>.TransactionHandler.getTransactionIdentifier(),
    null,
    payload
);
system.debug(JSON.serialize(response));