Newer Version Available
tpm-promotion Component
Namespace
Events
Here’s the event payload structure.
onfocusedareachange
This event is triggered when a different area of the application is navigated to.
The possible values of area are:
- PROMOTION_PLANNING: This area identifies the Promotion Planning UI.
- PL_GRID: This area identifies the Promotion PL.
The possible values of section are:
- PROMOTION: Promotion level components section.
- TACTIC: Tactic level components section.
onisplgridfilteropenchange
This event is triggered when the P&L filters are opened (true) or closed (false).
onstatuschange
This event is triggered when the lifecycle state of the TPM promotion component changes. Status changes are triggered by lifecycle operations on the promotion record.
The possible values are:
- LOADING: The promotion is being loaded.
- VALID: The promotion is loaded and can be interacted with.
- SAVING: The promotion is being saved to the database.
- ERROR: An irrecoverable error has occurred.
oncalculationstatuschange
This event is triggered when the promotion grids are calculated or recalculated.
The possible values are:
- LOADING: The calculations are being processed, or the engine is loading.
- VALID: The calculations are completed and values can be requested
- ERROR: An irrecoverable error has occurred.
- DISABLED: Calculations Engine is disabled for the promotion.
oneditmodechange
This event is triggered when the edit mode changes for the page.
onselectedtacticidchange
This event is triggered when the focused tactic changes.
The possible values of are:
- null: No focused tactic found.
- A tactic ID: The ID of the focused tactic.
onpromotionchange
This event is triggered when the promotion attributes change.
The event value contains all the Promotion SObject attributes.
oneffectivecategorieschange
This event is triggered when the effective categories of the promotion change.
The event value contains an array of product IDs from the effective categories.
oneffectivebrandschange
This event is triggered when the effective brands of the promotion change.
The event value contains an array of product IDs from the effective brands.
ontacticschange
This event is triggered when the tactic attributes change.
The event value contains all the Tactic sObjects and their attributes.
ontacticfundschange
This event is triggered when the Tactic fund properties change.
The event value contains all the Tactic Fund sObjects and their attributes.
onpromotionattachmentlinkschange
This event is triggered when the properties of the Promotion Attachment link change.
Promotion attachment links are junction objects between a Promotion record and a Promotion Attachment Record.
The event value contains all the Promotion Attachment Link sObjects and their attributes.
onpromotionattachmentschange
This event is triggered when the properties of the Promotion Attachment sObject change.
Promotion Attachment records must be created before they can be linked to a promotion during the save process.
The event value contains all the Promotion Attachment Link sObjects and their attributes.
onpromotioncategorieschange
This event is triggered when the promotion categories change.
The event value is an array of Product2 IDs referencing Category records.
onsubaccountschange
This event is triggered when the promotion sub-accounts change.
onparticipatingcustomerschange
This event is triggered when the participating customers of a promotion change. The participating customers list is used to determine the customers the promotion is pushed to during the push process.
ontacticconditioncreationdefinitionschange
This event is triggered when the Tactic Condition Creation definitions for the tactics included in the promotion change.
The event value is an array of Tactic Condition Creation Definition sObject records and their attributes.
oncustomstatechange
This event is triggered when the custom state changes. Custom State is a special area of the promotion state where customers can set their custom structures that are processed and committed in Salesforce at the same time as the promotion.
onpromotionproductschange
This event is triggered when the promotion products change.
The event value is an array of all promotion product IDs.
onupliftpredictionavailablechange
This event is triggered when the uplift prediction availability changes. It indicates if the feature is enabled for the promotion.
onupliftpredictionenabledchange
This event is triggered based on whether the uplift prediction can be performed on the current promotion or not. It indicates possible errors with the promotion state that prevent uplift prediction from being executed.
onupliftpredictionprocessstatuschange
This event is triggered when the uplift prediction process state changes.
The possible values are:
- RUNNING
- IDLE
onmanualinputschange
This event is triggered when the promotion manual inputs change. The event payload contains an array of TPMManualInput instances being used for the TPM Grids.
onaclchange
This event is triggered when the edit access rights in the Access Control List (ACL) changes for a promotion or tactic. This event notifies about an ACL change. Get the actual value of an edit access right element using the isVisible and isEditable methods of the tpm-promotion class.
onkpivalidationschanges
This event is triggered when the promotion grids are calculated or recalculated, and validation KPIs are emitting error messages.
Example Implementation
tpm-promotion Component Methods
exportKPIs
API Version
58.0
Signature
exportKPIs(options)
Properties
| Name | Type | Description | Required or Optional |
|---|---|---|---|
| options.subsets | List<String> | List of loaded KPI subsets to retrieve data from. You can get a list of loaded subsets using the getKPISubsets() method. Provide either the KPI subsets or the KPI names. |
Optional |
| options.kpis | List<String> | List of KPI names to retrieve data from. You can get a list of loaded KPI names using the getKPIs() method. Provide either the KPI subsets or the KPI names. |
Optional |
| options.levels | List<String> | List of loaded levels to retrieve data from. You can get a list of loaded levels using the getLevelNames() method. |
Optional |
| options.periods | List<String> | List of loaded period types to retrieve data. You can get a list of loaded period types using the getPeriodTypes() method. |
Optional |
| options.format | List<String> | Format in which the response is returned. Possible formats are:
The default format is JSON. |
Optional |
The returned data is a list of rows (JavaScript objects or CSV rows). Each row represents the value of the KPI for the determined level. Each row contains values for all the periods specified in the request.
Example Implementation
duplicateTactic
API Version
This method generates a tactic record using the tacticId as a base. You can add the generated tactic record to the promotion data by calling setTacticField for all the fields.
60.0
Signature
duplicateTactic(tacticTemplateId)
tacticTemplateId: String. Record ID of the tactic template.
Example Implementation
generateTactic
API Version
55
Signature
generateTactic(tacticTemplateId)
Example Implementation
getProperty
API Version
55.0
Signature
getProperty(propName)
The available properties to retrieve are:
- focusedArea
- status
- calculationStatus
- editMode
- selectedTacticId
- promotion
- tactics
- tacticFunds
- promotionAttachments
- promotionAttachmentLinks
- promotionCategories
- productFilter
- subAccounts
- participatingCustomers
- tacticConditionCreationDefinitions
- upliftPredictionProcessStatus
- upliftPredictionEnabled
- upliftPredictionAvailable
- promotionProducts
- manualInputs
- kpiValidations
- customState
Example Implementation
getLevelNames
API Version
58.0
Signature
getLevelNames()
Example Implementation
getKPISubsets
API Version
58.0
Signature
getKPISubsets()
Example Implementation
getKPIs
API Version
58.0
Signature
getKPIs()
Example Implementation
getPeriods
API Version
58.0
Signature
getPeriods()
Example Implementation
getPeriodTypes
API Version
58.0
Signature
getPeriodTypes()
Example Implementation
isEditable
API Version
The record ID must be a promotion ID or a tactic ID.
60.0
Signature
isEditable(recordId, eaRight)
isVisible
API Version
The record ID must be a promotion ID or a tactic ID.
60.0
Signature
isVisible(recordId, eaRight)
push
API Version
55
Signature
push()
Example Implementation
reload
API Version
55
Signature
reload()
Example Implementation
removeCallback
API Version
55
Signature
removeCallback(event, callback)
Example Implementation
save
API Version
55
Signature
save()
Example Implementation
selectTactic
API Version
55
Signature
selectTactic(tacticId)
Example Implementation
setCallback
API Version
55
Signature
setCallback(tacticFunds)
Example Implementation
setCustomState
API Version
55
Signature
setCustomState(customState)
Example Implementation
setEditMode
API Version
55
Signature
setEditMode(value)
Example Implementation
setEditable
API Version
After the editability value of an EARight element is set for the record, the promotion UI is re-rendered to reflect the changes. But, after you save the promotion, the EARight elements are reset to the initial values provided by TPM and the customization hook.
60.0
Signature
setEditable(recordId, eaRight, value)
- recordId: ID of a promotion or tactic
- eaRight: An EARight element
- value: A boolean value
setVisible
API Version
After the EARight element visibility value is set for a record, the promotion UI is re-rendered to reflect the changes. But, after you save the promotion, the EARight elements are reset to the initial values provided by TPM and the customization hook.
60.0
Signature
setVisible(recordId, eaRight, value)
- recordId: ID of a promotion or tactic
- eaRight: An EARight element
- value: A Boolean value
setParticipatingCustomers
API Version
55
Signature
setParticipatingCustomers(participatingCustomers)
Example Implementation
setPLGridFilterOpen
API Version
55
Signature
setPLGridFilterOpen(value)
Example Implementation
setPromotionAttachmentLinks
API Version
55
Signature
setPromotionAttachmentLinks(attachmentLinks)
Example Implementation
setPromotionAttachments
API Version
55
Signature
setPromotionAttachments(attachments)
Example Implementation
setPromotionCategories
API Version
55
Signature
setPromotionCategories(categories)
Example Implementation
setPromotionField
API Version
55
Signature
setPromotionField(field, value)
Example Implementation
setPromotionManualInputs
API Version
Manual grid edits are an array of TPMManualInput instances. You can add new entries, or remove entries from the existing array of elements.
60.0
Signature
setPromotionManualInputs(manualInputs)
Example Implementation
setSubAccounts
API Version
55
Signature
setSubAccounts(subAccounts)
Example Implementation
setTacticConditionCreationDefinitions
API Version
55
Signature
setTacticConditionCreationDefinitions(tacticConditionCreationDefinitions)
Example Implementation
setTacticField
API Version
55
Signature
setTacticField(tacticId, field, value)
Example Implementation
setTacticFunds
API Version
55
Signature
setTacticFunds(tacticFunds)
Example Implementation
predictUplift
API Version
58.0
Signature
predictUplift()