I need to be able to create issues in different projects when on a certain event.
Now I tried to trigger a clone when issue is updated and the component is set to "flytta".
The problem I get is that everytime I update the issue it creates a new clone.
I want scriptrunner to create the issue once when I added the component.
How to solve what event I should choose from when I want to trigger the action ?
Hello @Patrik Ytterström
You can use the Script Listener provided by the plugin
"Clones an issue, and links"
The condition you have to enter is that you have to check if the update is on the component field or not.
Thus, this should work
def field = event.getChangeLog().getRelated('ChildChangeItem').any{ it.field.toString().equalsIgnoreCase("Component")}
if(field) {
return true;
}
return false;
In the above code you check whether the issue updated event is for the component or not and if it is then in the if statement above you can add your original statement which checks if the current component contains flytta or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks :), there is only one problem and that is if I want to add one more component the condition will be true as long as "flytta" is there.
I want the condition to listen only when a certain component is added, not if it "contains" the value. I will try to build on your code but would appreciate help.
def field = event.getChangeLog().getRelated('ChildChangeItem').any{ it.field.toString().equalsIgnoreCase("Component")}
if(field) {
if(issue.components*.name.contains('flytta')){
return true;
}
return false;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I modified your script and got to this and it looks like it works as it should.
def field = event.getChangeLog().getRelated('ChildChangeItem').any{ it.field.toString().equalsIgnoreCase("Component")}
if(field){
def cField = event.getChangeLog().getRelated('ChildChangeItem').find{it.field == "Component"}
if(cField.newstring == "flyttar"){
return true
}
else{
return false
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Patrik Ytterström
Glad to know that it's working now, please accept/upvote answer so that others are helped as well. thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.