In eADM, notifications are sent when a rule set matches a user based on specific criteria. These criteria can be based on events (e.g., "User was created") or on a selection of objects with certain attribute values (e.g., "User start date is in two days").
A problem can arise with rules based on attributes rather than events. For example, a rule to send a welcome SMS to a new employee two days before their start date might be triggered multiple times if several system synchronizations run on that day. Without an additional check, the user would receive the same message repeatedly.
To prevent this, you must add a condition to the rule set that checks if the message has already been sent. This is done using the[COUNTMESSAGESENT] function.
Procedure
Follow these steps to ensure a notification is sent only one time.
-
Navigate to and open the rule set that triggers the notification you want to modify.
-
Add a new rule condition with the following three parts:
-
Attribute:
[COUNTMESSAGESENT; MessageID]. (E.g.[COUNTMESSAGESENT; 816]) -
Condition:
is equal to -
Argument:
0
-
This condition ensures the rule will only apply if the specified message has been sent zero times to the user.
Variations of the [COUNTMESSAGESENT] Function
The function can be used in several ways depending on your needs.
-
Check for Any Message from the Rule Set. If a rule set is used for multiple messages, you can leave the message ID empty to check if any message has been sent by the rule.
When the message ID is left empty — equivalent to passing 0, e.g. [COUNTMESSAGESENT;] — the expression does not check a single fixed template. Instead, it evaluates in the context of whichever message template's send actually triggered the rule set. In practice this means the condition always asks "has this outbound message already been sent to this recipient", regardless of which template is doing the sending.
This makes it possible to reuse one rule set as the duplicate-send guard for several different message templates, instead of building a near-identical rule set with a hardcoded message ID for each one.
Note: When using this function, the preview function in the rule set editor will not work.
This is a direct consequence of the context-binding above: the expression builder's preview evaluates the rule set on its own, outside of any actual message send, so there is no triggering message template available to supply the context the empty messageId relies on. This applies whether the rule set is opened directly in the expression builder or previewed from within a message flow that has not yet fired.
-
Allow Resending After a Specific Period. You can add a date parameter to allow the notification to be sent again after a certain amount of time has passed. For example, the expression
[COUNTMESSAGESENT;816;[NOW-32]]will allow the message to be resent if the previous one was sent more than 32 days ago.