Sync trigger in JIRA

Originally asked by Mikael Bohlin on 13 March 2020 (original question)


How to only sync from JIRA when a new comment Is made or when adding a label ?Source: Jira Cloud (old community)


Answer by Juan Grases on 27 March 2020

Hi! In Jira Server 4.7.4 you can now know the Jira Event which push this sync and play with it:

// works from 4.7.4
//Place this line on top of your outgoing sync to ensure that only comment created events would trigger sync
if(firstSync && (!eventTypeId || eventTypeId != com.atlassian.jira.event.type.EventType.ISSUE_COMMENTED_ID)) return; 

Answer by Juan Grases on 13 March 2020

Hi!

Unfortunately you cannot exalate based on a particular change but rather on the content of the issue (is based on JQL). For example when an issue is updated/created, you can exalate it automatically if it has any label:

labels is not empty

You can also rely on the outgoing sync groovy scripts of your connection to decide when something gets synced. Just use so Ifs conditions and return when you don’t want to sync:

// Place this line on top of your outgoing sync
// Only issues with comments will be synced
if(issue.comments.size() == 0) return;

Another alternative is to rely on post functions, you can get more details on https://docs.idalko.com/exalate/display/ED/Triggering+a+synchronization+for+Jira#TriggeringasynchronizationforJira-ExalateNowpostfunction

Hope this is helpful,

Best regards,

Juan


Comments:

Mikael Bohlin commented on 19 March 2020

Hi,

all issues will have comments. We need a way sync the issue only when an update is done or a label is added. Any ideé how to solve this ?

How to setup a sync based on a label ?

Regards

Mikael

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