Account Plan LWC Reference
The tpm-account-plan LWC is a service component that loads a TPM account plan, exposing methods to update the account plan state, and events to keep all UI components of the account plan page in sync when the account plan state changes.
The content in this Consumer Goods Cloud Trade Promotion Management documentation is confidential and may be viewed only by customers or partners as authorized by Salesforce, and copying and further distribution is prohibited without prior written consent from Salesforce. The content is the highly confidential and proprietary information of Salesforce and is protected under the confidentiality obligations of your Agreement with Salesforce. Accordingly, the content may be used only as necessary in order to implement the Consumer Goods Cloud Trade Promotion Management functionality.
account-plan-id: Id. Required. The ID of the account plan record to load.
Here’s the event payload structure.
This event is triggered when the lifecycle state of the TPM account plan component changes. Status changes are triggered by lifecycle operations on the account plan record.
The possible values are:
LOADING: The account plan is being loaded.VALID: The account plan is loaded and can be interacted with.SAVING: The account plan is being saved to the database.ERROR: An irrecoverable error has occurred.
This event is triggered when the account plan 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: The calculations engine is disabled for the account plan.
This event is triggered when the account plan’s selected product category filter changes. The event contains the selected category product ID.
This event is triggered when the account plan subset filter changes. The event contains the selected category product ID.
Here’s an example of how to use the tpm-account-plan component.
Here are the methods supported by the tpm-account-plan LWC.
-
This method returns a promise resolving to the values of the KPIs for the selected KPI subsets or names, levels, and period types.
-
Imperatively retrieve the account plan state properties.
-
This method returns a promise resolving to the list of levels that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
-
This method returns a promise resolving to the list of KPI subsets that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
-
This method returns a promise resolving to the list of KPIs that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
-
This method returns a promise resolving to the list of periods that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
-
This method returns a promise resolving to the list of period types that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
-
This method sets an array of manual inputs in the account plan service component.
This method returns a promise resolving to the values of the KPIs for the selected KPI subsets or names, levels, and period types.
58.0
exportKPIs(options)
| 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.
Imperatively retrieve the account plan state properties.
59.0
getProperty(propName)
The available properties to retrieve are:
statuscalculationStatusmanualInputskpiSubsetFiltercategoryFilter
This method returns a promise resolving to the list of levels that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
59.0
getLevelNames()
This method returns a promise resolving to the list of KPI subsets that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
59.0
getKPISubsets()
This method returns a promise resolving to the list of KPIs that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
59.0
getKPIs()
This method returns a promise resolving to the list of periods that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
59.0
getPeriods()
This method returns a promise resolving to the list of period types that are currently loaded in the calculation engine. If the calculation status isn’t valid, the method returns an error.
59.0
getPeriodTypes()
This method sets an array of manual inputs in the account plan service component.
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
setManualInputs(manualInputs)