Summary
1. Email Notifications - "weight"
We normally use Email Notifications to send selected users email about specific activities in the system, such as updates to incidents or change requests.
One of the options is the 'weight'. The email notification with the highest weight is sent but only if the generated emails that are being compared have the same recipients and target table.
Email notification weight is defined as a required numerical value for this notification's priority relative to other notifications:
- With the same target table and recipients
- The system only sends the notification with the highest weight
All other notifications with lowest weight are moved from the Outbox mailbox to the Skipped mailbox. So far so good.
There is a 'Order' setting on the Email notification. On my testing, 'Order' does not affect the behavour.
The default value weight 0 causes the system to always send the notification (assuming the conditions are met).
Email notifications have great features that allow you to add priority to certain notifications over others. However, weight can be misunderstood.
Weight will not avoid duplicate notification ON MANY CASES as weight is considered based on the recipient list and target table.
2.How email notification "weight" option works
When the system is sending a notification:
- If an event is triggered (e.g. Issue is commented), the email notification matching the conditions will execute.
- Disregarding weight, if the notification condition passes and it generates valid recipients (emails), it generates an outbound email.
- If the outbound emails HAVE EXACTLY SAME 'Recipient' , 'Target', and Conditions only the one with highest weight is sent plus any one with weight=0.
The rest of the emails are marked as 'State'="Ignored"
On the email, the target and the recipients need to match so the weight is compared.
3.Testing how email notification "weight" option works
Let me run some examples:
Assuming the following notifications:
|
Name |
Weight |
Notification |
T10 |
10 |
Notification |
T20 |
20 |
EXAMPLE #1: Result outbound emails have same target and recipients but different weights
If after email notification execution:
Notification T10 |
|
it generates mail1 outbound email target:INC1 + recipients:t1@c.com + weight:10 |
Notification T20 |
|
it generates mail2 outbound email target:INC1 + recipients:t1@c.com + weight:20 |
RESULTS: It causes the following results:
Notification T10 |
|
mail1 'State'= "Ignored" |
Notification T20 |
|
mail2 'State'= "Processed" |
It is because 'Recipient' and 'Target' are the same, it takes the highest weight
Results: it will only sent ONE email. The one with highest weight,
EXAMPLE #2: Result outbound emails have same target but different recipients and weights
If after email notification execution:
Notification T10 |
|
it generates mail1 outbound email target:INC1 + recipients:t1@c.com,t2@c.com + weight:10 |
Notification T20 |
|
it generates mail2 outbound email target:INC1 + recipients:t1@c.com + weight:20 |
RESULTS: It causes the following results:
Notification T10 |
|
mail1 'State'= "Processed" |
Notification T20 |
|
mail2 'State'= "Processed" |
It is because 'Recipient' are different, it sent both. NOTE it will create TWO EMAILS for 't1@c.com'
Results: it will sent both. The recipients did not matched.
EXAMPLE #3: One notification is not able to generate the outbound email
If after email notification execution:
Notification T10 |
|
it generates mail1 outbound email target:INC1 + recipients:t1@c.com + weight:10 |
Notification T20 |
|
it can't generate recipients so it can't create mail2 |
RESULTS: It causes the following results:
Notification T10 |
|
mail1 'State'= "Processed" |
Notification T20 |
|
mail2 DOES NOT EXIST. |
It is because it's the only one, it sent mail1 (even when in theory it should be Notification T20)
Results: It will sent the only email generated.
In conclusion, all email notifications with recipients will generate an email outbound (ready to be sent or not) and the weight is copied from the notification.
If there is not recipients for the email notification, no email is generated (and it is not because of the weight that emails are not generated).
Finally, if the email outbound is NOT sent because of the WEIGHT, it will be on the 'skipped' mailbox wit 'State' of "Ignored"
EXAMPLE #4: Result outbound emails have same target, recipients, different weights, and different conditions
If after email notification execution:
Notification T10 |
Condition: Task Type =Task |
it generates mail1 outbound email target:INC1 + recipients:t1@c.com + weight:10 |
Notification T20 |
Condition: Task Type =task |
it generates mail2 outbound email target:INC1 + recipients:t1@c.com + weight:20 |
RESULTS: It causes the following results:
Notification T10 |
Condition: Task Type =Task |
mail1 'State'= "Processed" |
Notification T20 |
Condition: Task Type =task |
mail2 'State'= "Processed" |
It is because 'Recipient' and 'Target' are the same with different weights
Results: it will only sent BOTH email. Despite Weights being different the conditions being different can cause both to send in this scenario due to case sensitivity.
To avoid this simply have 1 notification per target with more granular criteria.
Example: When setting up multiple notifications do not use
Notification #1 to a table like sysapproval_approver and criteria Approval for.Task Type = Requested Item.
Notification #2 to a table like sysapproval_approver and no criteria.
The condition evaluations on notification #2 can bypass the weight check causing duplicate notifications.
Related Links
More information can be found here: