Newer Version Available

This content describes an older version of this product. View Latest

APEX Configuration

In order to customize the Promotion Save process in APEX layer, you must introduce a callable APEX class as a customization hook.
In order to setup the hook, go to SetupCustom Metadata Types CGCloud Process Customization , and add the following records:
  • Label: TPM_Promotion_Save
  • DeveloperName: TPM_Promotion_Save
  • Class: <Your Callable APEX Class>
  • Enabled: checked
  • Method: save
APEX class structure
1global class <Your Callable APEX Class> implements System.Callable {
2
3    global Object call(String action, Map<String, Object> args) {
4        // Get the TPM_Promotion instance from the arguments
5        TPM_Promotion promotion = (TPM_Promotion) args.get('promotion');
6        // Retrieve your custom state sent to UI
7        String payload = (String) args.get('customState');
8        // Read Transaction Id
9        String txId = (String) args.get('txId');
10        
11        // Your custom logic goes here
12    }
13}
The call method is called during the Promotion Save Process. At this method, you can add your customizations to the process:
  • Create additional records
  • Modify TPM records

The TPM_Promotion instance contains an object with all the Managed Package Promotion data.

Note