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 Setup → Custom 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
global class <Your Callable APEX Class> implements System.Callable {
global Object call(String action, Map<String, Object> args) {
// Get the TPM_Promotion instance from the arguments
TPM_Promotion promotion = (TPM_Promotion) args.get('promotion');
// Retrieve your custom state sent to UI
String payload = (String) args.get('customState');
// Read Transaction Id
String txId = (String) args.get('txId');
// Your custom logic goes here
}
}
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