How to count the Reopen Incident count for a custom table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2023 05:01 AM
Hi All,
I have built a custom table called "Service Desk Incidents", and have built a button called "Reopen SD Incident" on the portal which will be only visible for resolved SD incidents. so, now I want to count how many times an SD Incident is getting reopened for reporting purposes. How do I achieve this. Can anyone please guide me.
Thank you in Advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2023 05:44 AM
Hi,
To track how many times an SD incident is getting reopened, you can create a new field on the "Service Desk Incidents" table called "Reopen Count" or similar. This field will be used to store the number of times the incident has been reopened.
Next, create a new business rule on the "Service Desk Incidents" table that triggers when the "Reopen SD Incident" button is clicked and the incident is already in a resolved state. The business rule should update the "Reopen Count" field by incrementing its value by 1.
Here's an example script for the business rule:
(function executeRule(current, previous /*null when async*/) {
if (current.state == 6 /*Resolved*/ && current.u_reopen_sd_incident == true /*Reopen SD Incident button clicked*/) {
current.u_reopen_count = (current.u_reopen_count || 0) + 1; // Increment reopen count field
current.update(); // Update incident record
}
})(current, previous);
Once the business rule is created, every time the "Reopen SD Incident" button is clicked on a resolved incident, the "Reopen Count" field will be incremented by 1. You can use this field for reporting purposes to track how many times an incident has been reopened.
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar