tpmGenericUtils Module

The tpmGenericUtils module provides replacements for accessing the @salesforce modules on components that have the cgcloud runtime namespace.

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.

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.

You can use the i18n object to get the internationalization properties. The properties exposed are the ones described in Salesforce Developer Component Library Documentation.

The UserId attribute returns the current User ID.

The FORM_FACTOR attribute returns the client form factor.

You can get the CGCloud namespace through the properties, CGCloudNamespace, and CGCloudNamespaceWithUnderscore.

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:

PropertyTypeDescription
options.kpiKPIDefinitionOptional. 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.kpiCodeStringOptional. The editable KPI code to create the manual input for.
Provide either options.kpi or options.kpiCode.
options.periodPeriodDefinitionRequired. The period definition to create the manual input for. You can get period definitions by calling the getPeriods() method.
options.tacticIdStringOptional. The Tactic ID the manual input applies to.
Required if the KPI has the promotion tactic scope. Default value is null.
options.productIdStringOptional. 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.componentIdStringOptional. 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.valueNumberOptional. The numeric value for the KPI. The default value is null.

Example