Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Customize the TPM Calendar Launchpad
To customize the promotion hover content and buttons on the TPM calendar launchpad UI,
create a callable Apex class as a customization hook.
- Log in to your Salesforce org, and go to Developer Console.
- Create a global Apex class that implements the System.Callable interface.
-
Add the global call method with these
parameters.
- action: String. The behavior for the method to exhibit.
-
params: Map<String,Object>.
Arguments with these key value pairs.
- txId: String. ID of the transaction.
- promoId: Id. ID of the promotion record.
- promotionHoverContent: Object of type PromotionHoverContent. The PromotionHoverContent class exposes methods to access the UI elements and content on the promotion launchpad. For a list of all the exposed methods, see PromotionHoverContent Class.
1global class < Your Callable APEX Class > implements System.Callable { 2 3 global Object call(String action, Map < String, Object > params) { 4 String txId = (String) params.get('txId'); 5 Id promoId = (Id) params.get('promotionId'); 6 PromotionHoverContent promoHoverContent = (PromotionHoverContent) params.get('promotionHoverContent'); 7 // Your custom logic goes here 8 return null; 9 } 10} -
To modify the content and the UI elements, use the methods exposed by the PromotionHoverContent class.
You can add a maximum of 4 attributes and 8 KPIs on a promotion launchpad.Here’s a sample Apex class that modifies the header content, adds attributes and KPIs, and sets the visibility of the edit button to false on the promotion launchpad.
1global class TPM_TC_LaunchPad_Cust implements System.Callable { 2 global class CustomizationException extends Exception {} 3 4 global Object call(String action, Map < String, Object > params) { 5 String txId = (String) params.get('txId'); 6 Id promoId = (Id) params.get('promotionId'); 7 PromotionHoverContent promoHoverContent = (PromotionHoverContent) params.get('promotionHoverContent'); 8 List < PromotionHoverContent.Attribute > attrs = promoHoverContent.getAttributes(); 9 promoHoverContent.setAttributes( 10 new List < PromotionHoverContent.Attribute > { 11 new PromotionHoverContent.Attribute( 12 attrs[0].getLabel() + '_cust', 13 attrs[0].getValue() + '_cust' 14 ), 15 new PromotionHoverContent.Attribute( 16 attrs[1].getLabel() + '_cust', 17 attrs[1].getValue() + '_cust' 18 ) 19 } 20 ); 21 List < PromotionHoverContent.Kpi > kpis = promoHoverContent.getKPIs(); 22 List < PromotionHoverContent.Kpi > newKpis = new List < PromotionHoverContent.Kpi > (); 23 for (PromotionHoverContent.Kpi kpi: kpis) { 24 newKpis.add( 25 new PromotionHoverContent.Kpi( 26 kpi.getReadCode(), 27 kpi.getLabel() + '_cust' 28 ) 29 ); 30 } 31 promoHoverContent.setKpis(newKpis); 32 promoHoverContent.setHeaderRow1( 33 promoHoverContent.getHeaderRow1() + '_cust' 34 ); 35 promoHoverContent.setHeaderRow2( 36 promoHoverContent.getHeaderRow2() + '_cust' 37 ); 38 promoHoverContent.setHeaderRow3( 39 promoHoverContent.getHeaderRow3() + '_cust' 40 ); 41 promoHoverContent.setEditButtonVisible(false); 42 return null; 43 } 44} - From Setup, in the Quick Find box, enter Custom Metadata Types, and then expand Custom Metadata Types.
- On the CGCloud Process Customization row, click Manage Records.
-
Click New, fill in these details, and then save your
work.
- Label: TPM_TradePlanning_PromotionHoverContent
- DeveloperName: TPM_TradePlanning_PromotionHoverContent
- Class: <Your Callable APEX Class>
- Method: call
- Enabled: Select the checkbox.
The Apex customization hook is enabled. The call
method updates the promotion launchpad on the trade calendar based on your custom
logic.