Hi all,
we have created an ScriptRunner Clone Issue Listener that is executed when the issue is updated. This script checks that a custom field has a specific value and if there isn't already any linked issue as "duplicated" it creates a "duplicated" issue in other Jira project.
This is the Condition:
if ((! issueLinkManager.getInwardLinks(issue.getId())*.issueLinkType.name.contains('Duplicate') ) &&
(! issueLinkManager.getOutwardLinks(issue.getId())*.issueLinkType.name.contains('Duplicate') ) &&
(cfValues['Sub-system responsible']?.value == 'PS')){
return true
} else {
return false
}The script works properly, but in the project there are other automation scripts triggered on the Issue Creation that changes fields such as the Component, the Organization or the Issue Type.
We have realized that sometimes the script creates the "duplicated" issue twice. And we think that could be that the ScriptRunner listener and the other automation are colliding. We think that the 3 automation executed when the issue is created, are triggering an Issue Update event in parallel, end everyone calls the ScriptRunner listener and creates the "duplicated issue" twice.
Does anybody know how to avoid this problem? May be we need to detect if the script is triggered by an automation or from a user action. But we do not know how to do it?
Any idea?
Thanks in advance!
Isidre