# How to set trigger for recently released versions?

**URL:** <https://community.exalate.com/t/how-to-set-trigger-for-recently-released-versions/4227>\
**Category:** General Questions\
**Tags:** onpremise-jira, usecase, triggers, migrated\_question, moved\
**Created:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-set-trigger-for-recently-released-versions/4227 "2024-11-04T06:40:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-set-trigger-for-recently-released-versions/4227/1 "2024-11-04T06:40:10Z")

</div>

_Originally asked by Berry Kersten on 18 May 2020 [(original question)](https://oldcommunity.exalate.com/questions/11339527)_

* * *

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

```auto
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?

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-set-trigger-for-recently-released-versions/4227/2 "2024-11-04T06:40:11Z")

</div>

_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

```auto
replica.customKeys.foo = new Date()

```

An alternative is to be more specific

```auto
// 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](https://stash.idalko.com/snippets/c695ddfc49b644729f02b2041b329fb3)  
With ScriptRunner you can capture the version event - and then call the external script to touch all related issues without modification

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-set-trigger-for-recently-released-versions/4227/3 "2024-11-04T06:40:12Z")

</div>

_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](http://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.

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-set-trigger-for-recently-released-versions/4227/4 "2024-11-04T06:40:12Z")

</div>

_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

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 6, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-set-trigger-for-recently-released-versions/4227/5 "2024-11-06T06:40:25Z")

</div>

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