How to Convert Remote Status Changes to Local Comments between Jira Cloud and Jira On-premise

    Warning: Despite our best efforts, code can change without notice due to a variety of factors. If you encounter an issue in any of the code shown here and find that a specific block of code is not correct, or is causing errors, please check with the Community to find an updated version.

    Each side of the connection has its own workflow, and you are only interested in the fact that the remote issue has changed status. This change should have no effect on the local status, but actually, be converted in a comment.

    This is pretty straightforward to do with a change processor.

    First, you need to ensure that the status information is included in the replica:

    ...
      replica.status = issue.status
    ...

    In your change processor you can add a comment whenever the status of the remote issue was changed:

    // Add a comment if the status of the remote issue was updated
    // Compare the replica status with the previous status
    //
    if (!replica.status.equals(previous?.status)) {
      // construct the comment
      String message = "${replica.key}: Status updated from '${previous?.status?.name}' to '${replica?.status?.name}'"
      issue.comments = commentHelper.addComment(message, issue.comments)
    }

    Here is how the result looks in your Jira: