After update/insert business rule with current.update() creates 2 sys_amb_message records with count: +1
As a result, single score reports on dashboards (with the ''Show real-time update' option checked) are increased with 2 instead of 1 when creating 1 new row that meets the conditions of the report.

Steps to Reproduce

1. Create a new business rule (after insert/update) against the [incident] table. Use this script:
(function executeRule(current, previous /*null when async*/) {
current.short_description = 'xx - ' + current.short_description;

})(current, previous);

2. Create a new report the type of 'Single Score' against the [incident] table. No need to add any filter. Aggregate on 'Count'.

3. On a Performance Analytics dashboard, add the Single Score report that was just created.

4. Add an interactive filter on the dashboard that is based on assignment group [sys_user_group] and mapped to [task.assignment_group].

5. While the dashboard is in edit mode, click the cogwheel on the report and select the 'Show real-time update' and 'Follow interactive filter' options.

6. Test the dashboard to confirm that the report follows the selected assignment group on the interactive filter. Leave the selected assignment group to be e.g. 'ACME Refrigerator Support'.

7. While the dashboard with the report is still open (so you can watch it), in another browser or tab, create a new incident and assign it to assignment group 'ACME Refrigerator Support'.

> Expected behavior:
The report counter increases with one only.

> Actual behavior:
The report counter increases with one twice (quickly - in a fast instance the first update might not even be noticable - the point is that it is increased with 2 instead of 1).
In the [sys_amb_message] table there are 2 records with the same time stamp and 'serialized cometd message' value "count":"+1" - which is why the increase was with 2 instead of 1.

8. Disable the business rule from step 1 and confirm that the issue no longer reproduces.


Modify the business rule to not fire on insert. (Do not use current.update on a business rule unless current.setWorkflow is set to false).

Make the business rule fire BEFORE insert/update and change the script so that you are not using current.update() as that would trigger the same business rules again.

Related Problem: PRB1294298

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2020-07-20 07:17:41