---
schema_version: "1"
id: 6752c3444ee4f55df0088a182e7a9659aed1d191be9662ae235f49fe66a428b1
title: Best Practices for PromotionPushRemoteActionExtension
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/tpm_best_practices_push_promotion.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/tpm_best_practices_push_promotion.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: db8ceac20756d3cfe251f3d9cccbbe39cf8eecad5735efada7df5d3792688a15
description: This topic focuses on different types of Apex implementations to push multiple parent promotions.
---
# Best Practices for PromotionPushRemoteActionExtension

This topic focuses on different types of Apex implementations to push multiple parent promotions.

For more information, see [PromotionPushRemoteActionExtension Class](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/global_tpm_promotion_push_remote_action.htm "This Apex class provides programmatic access to the TPM Push Promotion Process Remote Actions."). The type of Apex implementations are:

- Sync Apex Snippet (legacy mode only)
- Queueable (both new and legacy modes)
- Future Method (new mode only)
- Apex Batch Class (new mode only)

An Apex code snippet is provided for each Apex class.

## Legacy Mode

In Summer ‘25 or earlier releases, [PromotionPushRemoteActionExtension Class](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/global_tpm_promotion_push_remote_action.htm "This Apex class provides programmatic access to the TPM Push Promotion Process Remote Actions.") used only Apex Flex Queue to push promotions. This method of using Apex Flex Queue is referred to as Legacy Mode in this topic. This method continues to be available in future releases.

## New Mode

In Winter ‘26 or later releases, a new method to push promotions using the PromotionPushRemoteActionExtension Apex class is introduced. To enable the new method, the PushPromotionExecutionMode system setting must be set to OffPlatform.

## Sync Apex Snippet

This approach of Apex implementation uses the legacy mode to push promotions using the PromotionPushRemoteActionExtension Apex class. It demonstrates how to push multiple parent promotions from one synchronous Apex execution context.

List<String> promotionIds = new List<String>{
    '<PARENTPROMOID01',
    '<PARENTPROMOID02'
    };

for (String promotionId : promotionIds) {
    String readParams = '{"promotionId":"' + promotionId.trim() + '"}';
    String txid = UUID.randomUUID().toString();
    cgcloud\_dev.PromotionPushRemoteActionExtension.pushBOPromotion(txid, readParams);
}

## Queueable

This approach of Apex implementation can use either the legacy mode or the new mode to push promotions using the PromotionPushRemoteActionExtension Apex class. It demonstrates how to push multiple parent promotions with a Queueable implementation. It requires implementation of an Apex class implementing Queueable and AllowsCallouts interfaces and an Apex code which schedules the queueable jobs (one job per parent promotion to push).

**Implement Queueable and AllowsCallouts**

public class SchedulePromotionPushQueueable implements Queueable, Database.AllowsCallouts {
  public String promotionId { get; set; }

  public void execute(QueueableContext qc) {
       String readParams = '{"promotionId":"' + this.promotionId + '"}';
       String txid = cgcloud\_dev.TransactionHandler.getTransactionIdentifier();
       cgcloud\_dev.PromotionPushRemoteActionExtension.pushBOPromotion(txid, readParams);
  }
}

**Scheduling Apex Snippet**

List<String> promotionIds = new List<String>{
    '<PARENTPROMOID01',
    '<PARENTPROMOID02'
    };

for (String promotionId : promotionIds) {
  SchedulePromotionPushQueueable q = new SchedulePromotionPushQueueable();
  q.promotionId = promotionId.trim();
  System.enqueueJob(q);
}

## Future Method

This approach of Apex implementation uses the new mode to push promotions using the PromotionPushRemoteActionExtension Apex class. It demonstrates how to push multiple parent promotions with a Future annotated method implementation. Each call to the future annotated method schedules one parent promotion.

public class SchedulePromotionPushFuture {
  public List<String> promotionIds { get; set; }

  public void execute() {
    for (String promotionId : this.promotionIds) {
      SchedulePromotionPushFuture.schedulePushPromotion(promotionId.trim());
    }
  }
  
  @future(callout=true)
  static public void schedulePushPromotion(String promotionId) {
       String readParams = '{"promotionId":"' + promotionId + '"}';
       String txid = cgcloud\_dev.TransactionHandler.getTransactionIdentifier();
       cgcloud\_dev.PromotionPushRemoteActionExtension.pushBOPromotion(txid, readParams);
  }
}

**Scheduling Apex Snippet**

SchedulePromotionPushFuture futureClass = new SchedulePromotionPushFuture();
futureClass.promotionIds = new List<String>{
    '<PARENTPROMOID01',
    '<PARENTPROMOID02'
    };
futureClass.execute();

## Apex Batch Class

This approach of Apex implementation uses the new mode to push promotions using the PromotionPushRemoteActionExtension Apex class. It demonstrates how to push multiple parent promotions with a Batchable implementation. It requires implementation of an Apex class implementing Batchable and AllowsCallouts interfaces and an Apex code which schedules the batch job. The execute method of the batch job schedules one parent promotion push per call. It’s required to use a batch size of 1 when scheduling the batch job.

public class SchedulePromotionPushBatch implements Database.Batchable<String>, Database.AllowsCallouts, Database.Stateful {

  public List<String> promotionIds { get; set; }

  public Iterable<String> start(Database.BatchableContext bc
) {
    return this.promotionIds;
  }

  public void execute(Database.BatchableContext bc, List<String> scope) {
       String readParams = '{"promotionId":"' + scope.get(0).trim() + '"}';
       String txid = cgcloud\_dev.TransactionHandler.getTransactionIdentifier();
       cgcloud\_dev.PromotionPushRemoteActionExtension.pushBOPromotion(txid, readParams);
  }

  public void finish(Database.BatchableContext bc) {
  }
}

**Scheduling Apex Snippet**

SchedulePromotionPushBatch batchClass = new SchedulePromotionPushBatch();
batchClass.promotionIds = new List<String>{
    '<PARENTPROMOID01',
    '<PARENTPROMOID02'
    };
Database.executeBatch(batchClass, 1);