How to set trigger for recently released versions?

Originally asked by Berry Kersten on 18 May 2020 (original question)


Hi,

I have a use case where sometimes a released version AND an unreleased fixVersion is set on an issue.
When that unreleased version is released (in the release hub) a sync must be performed by using a trigger.

So, in this example (when having a released version AND an unreleased fixVersion):
when I release the (unreleased) version AND setting the date to (for example) today, then I see the corresponding issue in the Issue Navigator when using the following JQL

fixVersion in releaseDate("after startOfDay(-1d) before 10d")

→ releaseDate is determined by using ScriptRunner

However, when using this JQL in a Trigger, then there’s no sync happening. I still have to edit the issue in order to perform the sync.

Does anyone have an idea to solve this problem? Is there another way to sync issues by a trigger when a release is set?


Answer by Francis Martens (Exalate) on 18 May 2020

There is no sync happening because the replica before and after the event is identical.
By adding following code snippet - you force a change on the replica, which leads to a sync

replica.customKeys.foo = new Date()

An alternative is to be more specific

// test if there is at least one fix version which is released
replica.customKeys.isreleased = 
                   (issue.fixVersions.find { it.released } != null)

Bonus

Have a look at this TriggerSync external script
With ScriptRunner you can capture the version event - and then call the external script to touch all related issues without modification


Answer by Berry Kersten on 18 May 2020

Hi Peter Hochstrasser, No. Currently I’m using the following outgoing sync rule:

replica.fixVersions = issue.fixVersions.findAll{it.released}

For the incoming sync I’m using

issue.customFields.“Patch version”.value = replica.fixVersions?.collect{it.name}.join(“,”)

So it only syncs released versions. In some cases users want to set an unreleased Fixversion, just to show that a version is planned for a specific issue.

When the release is actually done, I want to (auto)sync the issue.


Answer by Peter Hochstrasser on 18 May 2020

Hi Berry Kersten

Do you synchronize the versions separately?

If so, you could implement the solution in the receiving JIRA project, if needed at all.

Yours truly

Peter


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.