How to use Scriptrunner "fire event when condition is true" on a non cloned issue ?


I'm totally new to scriptrunner and i would like to use it for a specific purpose.

When i create an issue i want "Issue created" event to be triggered (default behaviour) but when on the same project, an issue is cloned i don't want to trigger the "Issue created" event.

I'm pretty sure that i can do it with the Scriptrunner - "Fire event when condition is true" but i can't see how. I've been through the scriptrunner website and found "hasLinkType" but since it's a JQL function it seems that i can't use it in a simple script.

Mostly the condition i want is :

!(issueFunction in hasLinkType("Cloners"))

that would return true if the issue has no Cloners Link.

I've also look into the API, but i'm completly lost. I wanted to find something like issue.linkName to put issue.linkName == Cloners. But i don't find the Instance variables of "issue" which is bothering me.. There is some example like "issue.priority?.name,,.." but i don't manage to find those instance variables

If anyone has a simple solution for what i want to do, or know how to find those instance variables i would be very gratefull !



2 answers

1 accepted

0 votes
Answer accepted

Well ! If anyone is interested.

I found a solution.

Actually the function getOutwardLinks() didn't work, the result was always empty. I think, it's because the issue is not fully indexed just after the creation (before the transition to the first status).

To detect that an issue was a Clone, i passed by the summary. To be precise, i used:


The statement is that the user will not change the name of the clone while Cloning it.

However, i didn't find how to delete the fourth event (which is useless in this case)

0 votes

If you are cloning an issue to the same project, I assume you don't want to fire the event because you get stuck in a loop where the issue keeps being cloned?

The create issue event is published by JIRA and there is no mechanism to prevent it.

The clone issue script is mainly to clone to another project. Is there a reason that you want it in the same project?

Hi !

Actually i don't want to clone it on the same project but it seems to be an unavoidable step. The main idea is to aboid to trigger the "issue created" event, to avoid to send mail when the issue created is a clone.

When i clone an issue, i can only select the name of the issue before validate it. If you have another way to clone the issue on another project without moving the source issue before, i'm very interested !

However, the way i see it, it should be possible to do exactly what i say.

In attachment i'll put something that don't work, but that represente the main idea of what i want. The event "DEVIS EN COURS" is an event that doesn't send mail. Besides, those post functions are on the first transition, between the start of the workflow and the first state "To do".

Regards,Post functions.PNG


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


251 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you