How to Get a Notification when Linked Issues of a Risk are Changed?

What if you wish to get a notification when your mitigation or verification action issue changes status? E.g. your risks should be now mitigated and its time to verify them.

To do that we need to make Jira trace all the linked issues to our risks and come back to us with a notification. The notification format can either be an email, a change in the issue status, or both.

Thus we have two separate tasks:

  • Trace or trail all linked issues, i.e. listen to the linked issues events.

  • If event is detected, send out a notification.

 

1. Tracing linked issues

In order to trace linked issues we need to build a system event listener. To build one with CPrime Powerscritps we need to add a new sil script and make it to a SIL listener.

The following sil script will listen to all linked mitigation actions from the project RISK and transition the risk to the “Mitigated” state when the mitigation issue gets resolved.

logPrint("DEBUG", "Found new event. Starting to handle it with Risk Issue status updater listener!"); // Statuses that reflect that mitigation action has resolved string[] statuses = {"Resolved", "Closed", "Done"}; string[] transtion_risk_from_status = {"In mitigation"}; string execute_transition_to_next_status="Risk mitigated"; // if the issue that sent out this message has no linked issues, then we can exit the process. if (size(linkedIssues(key)) == 0) { logPrint("DEBUG", "No linked issues found on this issue!"); return; } else // the issue has linked issues! { if (!elementExists(statuses, key.status)) { //if the linked issue was transitioned to some other state we do not care about that //and can exit the script logPrint("DEBUG", "Not important transition for us"); return; } //take all links by link type "Risk Mitigation" with direction "mitigates" //-1, 0, 1 :Negative means inward links. Positive means outward links. Use zero to get both outward and inward links. string[] linkedIssues = linkedIssues(key, "Risk Mitigation", 1); if (size(linkedIssues)==0) { logPrint("DEBUG", "No linked issues with suitable link type not found on this issue!"); return; } else //found correct link types! { for(string issue in linkedIssues) { logPrint("DEBUG", "Linked issue -" + %issue%.key + " is in status - " +%issue%.status); if(elementExists(transtion_risk_from_status, %issue%.status)) { //transition linked risk issue to state "Mitigated" logPrint("DEBUG", "Success!"); autotransition(execute_transition_to_next_status, %issue%.key); } } } }

 

2. Sending notifications

There are different solutions for notifications. First and simplest is to send out a Jira notification email. Second option is to “raise a flag” on a Jira issue and detect that by viewing/reviewing issues.

a) Raise a flag

Raising a flag can have different meanings. To illustrate a change we can update the risk issue status or update some field values. We can then see it in SoftComply Risk Management Table view or in the Dashboard. See more at https://softcomply.atlassian.net/wiki/spaces/SS/pages/1590132751 and https://softcomply.atlassian.net/wiki/spaces/SS/pages/1590427661

b) Customising Jira notifications

Configure email notifications for a custom event

Summary:

Fire a custom system event from workflow transition post function. Catch that event in your risk project notifications scheme.