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
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.