Alert
Alerts
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Allow creation, removal, re-validation and retrieval of alerts that might get visible to Business Manager users.
The alerts have to be registered by the ‘alerts.json’ descriptor file in a cartridge assigned to the Business Manager site. The descriptor file itself has to be defined in ‘package.json’ of that cartridge using a property ‘alerts’ and providing its path that is relative to the ‘package.json’. The ‘alert.json’ descriptor files contain the ‘alert descriptions’, which are referenced by their ID throughout the API.
For example, the ‘alerts.json’ file could have the following content:
1{
2 "alerts": [
3 {
4 "alert-id": "missing_org_config",
5 "menu-action": "global-prefs_custom_prefs",
6 "message-resource-id": "global.missing_org_config",
7 "priority": "ACTION",
8 "remediation": {
9 "pipeline":"GlobalCustomPreferences",
10 "start-node":"View"
11 }
12 },
13 {
14 "alert-id":"promo_in_past",
15 "menu-action":"marketing_promotions",
16 "context-object-type":"Promotion",
17 "message-resource-id":"promotion.in_the_past",
18 "priority":"WARN",
19 "remediation": {
20 "pipeline":"ViewApplication",
21 "start-node":"BM",
22 "parameter":"screen=Promotion"
23 }
24 }
25 ]
26}The referenced menu actions can be found in the ‘bm_extensions.xml’ file of a Business manager extension cartridge (a sample file containing all current menu entries is provided when creating a new extension cartridge in Studio).
This class does not have a constructor, so you cannot create it directly.
| Method | Description |
|---|---|
| static addAlert(String, PersistentObject, String[]) | Creates a new alert for the given ID and context object. |
| static addAlert(String, String, String[]) | Creates a new alert for the given ID and ID of the context object. |
| static addAlert(String, String[]) | Creates a new alert for the given ID. |
| static getAlerts(String…) | Retrieves all alerts for a set of alert descriptor ID. |
| static getAlertsForContextObject(PersistentObject, String…) | Retrieves all alerts for a set of alert descriptor ID and the given context object. |
| static getAlertsForContextObject(String, String…) | Retrieves all alerts for a set of alert descriptor ID and the given context object ID. |
| static removeAlert(String) | Removes all alerts for the given alert descriptor ID. |
| static removeAlert(String, PersistentObject) | Removes the alert for the given alert description and context object. |
| static removeAlert(String, String) | Removes the alert for the given alert description and context object ID. |
| static revalidateAlert(String, Function, String[]) | Re-evaluates the process function, and creates or removes the respective alert. |
| static revalidateAlert(String, PersistentObject, Function, String[]) | Re-evaluates the process function, and creates or removes the respective alert. |
| static revalidateAlert(String, Object, String, Function, String[]) | Re-evaluates the process function, and creates or removes the respective alert. |
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Creates a new alert for the given ID and context object. If such an alert already exists, no new one is created, and the existing one is not modified. Multiple alerts for the same alert descriptor ID may exist, as long as they reference different objects. To refer to the same alert afterwards (e.g. to remove the alert) the same object must be provided.
Parameters:
Creates a new alert for the given ID and ID of the context object. If such an alert already exists, no new one is created, and the existing one is not modified. Multiple alerts for the same alert descriptor ID may exist, as long as they reference different objects. To refer to the same alert afterwards (e.g. to remove it) the same object ID must be provided.
Use this method when the alerts refers to an object which is not a PersistentObject.
Parameters:
Creates a new alert for the given ID. If such an alert already exists, no new one is created, and the existing one is not modified.
Parameters:
Retrieves all alerts for a set of alert descriptor ID.
Parameters:
Returns:
Retrieves all alerts for a set of alert descriptor ID and the given context object.
Parameters:
Returns:
Retrieves all alerts for a set of alert descriptor ID and the given context object ID.
Parameters:
Returns:
Removes all alerts for the given alert descriptor ID. This method will remove also alert referencing context objects, as long as they reference the same alert description.
Parameters:
Removes the alert for the given alert description and context object.
Parameters:
Removes the alert for the given alert description and context object ID.
Parameters:
Re-evaluates the process function, and creates or removes the respective alert. The process function must return true when the alert should be created, and false when it should be removed. When the process function states that the alert should be created, but it already exists, it is not created again. Instead, the existing alert is updated with the supplied parameters.
Parameters:
Re-evaluates the process function, and creates or removes the respective alert. The context object is handed as the only parameter to the process function. The process function must return true when the alert should be created, and false when it should be removed. When the process function states that the alert should be created, but it already exists, it is not created again. Instead, the existing alert is updated with the supplied parameters.
Parameters:
Re-evaluates the process function, and creates or removes the respective alert. When the optional context object is supplied, it is handed as the only parameter to the process function (if its not supplied, no parameter is given to the function). The process function must return true when the alert should be created, and false when it should be removed. When the process function states that the alert should be created, but it already exists, it is not created again. Instead, the existing alert is updated with the supplied parameters. Use this variant of the function when the context object is not a persistent object. In this case the ID to be assigned to the alert must be supplied as an additional parameter. (Either both the context object and the ID must be provided, or none of them)
Parameters: