Newer Version Available
tpmGenericUtils Module
Namespace
Implementation Example
Example: Perform Apex Calls
To call Apex methods, this module provides the apex, and apexCacheable functions. The Apex method to be called must be a global class, implementing the System.Callable interface.
In your custom LWC, use the apex, and apexCacheable methods. The difference between apex, and apexCacheable is that apexCacheable uses the Lightning Web Components caching layer.
Example: Load Static Resources
To get the URL of the static resource to be loaded, use the getStaticResourceURL function, and then load the static resource using the standard Lightning Web Components tools.
Example: Access the Internationalization Properties
You can use the i18n object to get the internationalization properties. The properties exposed are the ones described in Salesforce Developer Component Library Documentation.
Example: Get the Current User ID
The UserId attribute returns the current User ID.
Example: Get the Client Form Factor
The FORM_FACTOR attribute returns the client form factor.
Example: Get the CGCloud Namespace
You can get the CGCloud namespace through the properties, CGCloudNamespace, and CGCloudNamespaceWithUnderscore.
Example: Use the TPMManualInput Class
The TPMManualInput class represents a manual input entry for the TPM grids. When reading manual inputs on TPM components, you receive an array of instances of the TPMManualInput class. By manipulating and setting this array again into the TPM component, you can change the loaded inputs for the TPM grids.
- Methods
- The TPMManualInput class supports the
following methods:
-
- getKPICode()
- Returns the manual input editable KPI code.
-
- getPeriodDateFrom()
- Returns the period from date for the manual input. If the manual input is for the total period, it returns null.
-
- getPeriodDateThru()
- Returns the period through date for the manual input. If the manual input is for the total period, it returns null.
-
- getTacticId()
- Returns the tactic ID of the tactic the manual input applies to.
-
- getProductId()
- Returns the product ID of the product the manual input applies to.
-
- getComponentId()
- Returns the component ID of the BOM Component the manual input applies to.
-
- getValue()
- Returns the value of the manual input.
-
- Constructor
- The constructor for creating an instance of the TPMManualInput expects the options object as a single parameter. The options passed in
this object define the characteristics of the manual input entry. Here are
the possible options you can pass to the constructor:
Property Type Description options.kpi KPIDefinition Optional. The KPI definition to create the manual input for. You can get KPI definitions by calling the getKPIs() method. To create the manual input, a KPI definition must be for an editable or an editable calculated compound main KPI. Provide either options.kpi or options.kpiCode.
options.kpiCode String Optional. The editable KPI code to create the manual input for. Provide either options.kpi or options.kpiCode.
options.period PeriodDefinition Required. The period definition to create the manual input for. You can get period definitions by calling the getPeriods() method. options.tacticId String Optional. The Tactic ID the manual input applies to. Required if the KPI has the promotion tactic scope. Default value is null.
options.productId String Optional. The product ID the manual input applies to. It can be any level of the product hierarchy (Category, Brand, and more). If not set, the manual input references the KPI total value. Default value is null.
options.componentId String Optional. The product ID of the BOM Component part where the input is applied. This option is only used for KPIs whose scope include BOM Components. The default value is null.
options.value Number Optional. The numeric value for the KPI. The default value is null. - Example
-