Scenarios Class

This APEX class provides programmatic access to the TPM Promotion Scenario information used in the Promotion. Scenarios define selectable sets of Promotion Level Manual Inputs overrides to simulate different combinations of active/inactive tactics and KPI overrides in a TPM Promotion. A TPM_Scenarios structure can contain up to five scenarios information.

Namespace 

1cgcloud

TPM_Scenarios Methods 

The following are methods for TPM_Scenarios.

  • global ScenarioParameter addScenarioParameter

    Index must be an scenario index between 1 and 5 (included) Adds a parameter to the scenario parameters of the selected scenario. The required attributes are the scenario index, the KPI Name to set (must be a Scenario KPI defined on the Promotion Template), the numeric value of the KPI and if the parameter is already applied (If applied, UI will not re-apply the value when loading the scenario information. If not applied, when loading the scenario, UI will apply the value of the parameter to the total of the KPI) .

  • global List<ScenarioParameter> getScenarioParameters

    Index must be an scenario index between 1 and 5 (included) Returns all the scenario parameters for the selected scenario.

  • global Map<String, Object> toGenericObject

    Serializes the scenarios information into a generic object. Useful for usage on remote calls.

  • global Object toGenericObjectParameters

    Index must be an scenario index between 1 and 5 (included) Serializes the parameters information for the selected scenario into a generic object. Useful for usage on remote calls.

  • global Object toGenericObjectManualInputs

    Index must be an scenario index between 1 and 5 (included) Serializes the manual inputs information for the selected scenario into a generic object. Useful for usage on remote calls.

  • global TPM_Scenarios load

    Loads the serialized scenarios information into the current instance. The current instance will be cleared and the scenarios represented by the payload will be loaded.

  • global String toJSONParameters

    Index must be an scenario index between 1 and 5 (included) Serializes the parameters information for the selected scenario into a String used for storage.

  • global String toJSON

    Serializes the scenarios information into a Sstring used for storage.

  • global String toJSONManualInputs

    Index must be an scenario index between 1 and 5 (included) Serializes the manual inputs information for the selected scenario into a String used for storage.

  • global TPM_Scenarios

    Creates an empty scenario sctructure.

  • global TPM_Scenarios load

    Loads the scenarios information from the parameter generic object. The current instance will be cleared and the scenarios represented by the payload will be loaded.

  • global TPM_Scenarios setScenarioManualInputs

    Index must be an scenario index between 1 and 5 (included) Sets the parameter manual inputs as manual inputs for the selected scenario.

  • global TPM_ManualInputs getScenarioManualInputs

    Index must be an scenario index between 1 and 5 (included) Returns the manual inputs for the selected scenario.

  • global void clear

    Removes all information for the five possible scenarios.

  • global void removeScenarioParameter

    Index must be an scenario index between 1 and 5 (included) Removes the passed in scenario parameter from the parameters of the selected scenario. If the ScenarioParameter is not part of the scenario, nothing is removed.

global ScenarioParameter addScenarioParameter 

Index must be an scenario index between 1 and 5 (included) Adds a parameter to the scenario parameters of the selected scenario. The required attributes are the scenario index, the KPI Name to set (must be a Scenario KPI defined on the Promotion Template), the numeric value of the KPI and if the parameter is already applied (If applied, UI will not re-apply the value when loading the scenario information. If not applied, when loading the scenario, UI will apply the value of the parameter to the total of the KPI) .

API Version 

55

Signature 

global ScenarioParameter addScenarioParameter(Integer scenarioIdx, String kpiName, Decimal value, Boolean applied)

global List<ScenarioParameter> getScenarioParameters 

Index must be an scenario index between 1 and 5 (included) Returns all the scenario parameters for the selected scenario.

API Version 

55

Signature 

global List<ScenarioParameter> getScenarioParameters(Integer scenarioIdx)

global Map<String, Object> toGenericObject 

Serializes the scenarios information into a generic object. Useful for usage on remote calls.

API Version 

55

Signature 

global Map<String, Object> toGenericObject()

global Object toGenericObjectParameters 

Index must be an scenario index between 1 and 5 (included) Serializes the parameters information for the selected scenario into a generic object. Useful for usage on remote calls.

API Version 

55

Signature 

global Object toGenericObjectParameters(Integer idx)

global Object toGenericObjectManualInputs 

Index must be an scenario index between 1 and 5 (included) Serializes the manual inputs information for the selected scenario into a generic object. Useful for usage on remote calls.

API Version 

55

Signature 

global Object toGenericObjectManualInputs(Integer idx)

global TPM_Scenarios load 

Loads the serialized scenarios information into the current instance. The current instance will be cleared and the scenarios represented by the payload will be loaded.

API Version 

55

Signature 

global TPM_Scenarios load(String payload)

global String toJSONParameters 

Index must be an scenario index between 1 and 5 (included) Serializes the parameters information for the selected scenario into a String used for storage.

API Version 

55

Signature 

global String toJSONParameters(Integer idx)

global String toJSON 

Serializes the scenarios information into a Sstring used for storage.

API Version 

55

Signature 

global String toJSON()

global String toJSONManualInputs 

Index must be an scenario index between 1 and 5 (included) Serializes the manual inputs information for the selected scenario into a String used for storage.

API Version 

55

Signature 

global String toJSONManualInputs(Integer idx)

global TPM_Scenarios 

Creates an empty scenario sctructure.

API Version 

55

Signature 

global TPM_Scenarios()

global TPM_Scenarios load 

Loads the scenarios information from the parameter generic object. The current instance will be cleared and the scenarios represented by the payload will be loaded.

API Version 

55

Signature 

global TPM_Scenarios load(Object data)

global TPM_Scenarios setScenarioManualInputs 

Index must be an scenario index between 1 and 5 (included) Sets the parameter manual inputs as manual inputs for the selected scenario.

API Version 

55

Signature 

global TPM_Scenarios setScenarioManualInputs(Integer scenarioIdx, TPM_ManualInputs manualInputs)

global TPM_ManualInputs getScenarioManualInputs 

Index must be an scenario index between 1 and 5 (included) Returns the manual inputs for the selected scenario.

API Version 

55

Signature 

global TPM_ManualInputs getScenarioManualInputs(Integer scenarioIdx)

global void clear 

Removes all information for the five possible scenarios.

API Version 

55

Signature 

global void clear()

global void removeScenarioParameter 

Index must be an scenario index between 1 and 5 (included) Removes the passed in scenario parameter from the parameters of the selected scenario. If the ScenarioParameter is not part of the scenario, nothing is removed.

API Version 

55

Signature 

global void removeScenarioParameter(Integer scenarioIdx, ScenarioParameter param)