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.

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.

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) .

55

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

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

55

global List<ScenarioParameter> getScenarioParameters(Integer scenarioIdx)

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

55

global Map<String, Object> toGenericObject()

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.

55

global Object toGenericObjectParameters(Integer idx)

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.

55

global Object toGenericObjectManualInputs(Integer idx)

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.

55

global TPM_Scenarios load(String payload)

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.

55

global String toJSONParameters(Integer idx)

Serializes the scenarios information into a Sstring used for storage.

55

global String toJSON()

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.

55

global String toJSONManualInputs(Integer idx)

Creates an empty scenario sctructure.

55

global TPM_Scenarios()

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.

55

global TPM_Scenarios load(Object data)

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

55

global TPM_Scenarios setScenarioManualInputs(Integer scenarioIdx, TPM_ManualInputs manualInputs)

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

55

global TPM_ManualInputs getScenarioManualInputs(Integer scenarioIdx)

Removes all information for the five possible scenarios.

55

global void clear()

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.

55

global void removeScenarioParameter(Integer scenarioIdx, ScenarioParameter param)