Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,664
Community Members
 
Community Events
176
Community Groups

How to use script runner to automatically exalate subtasks whenever a parent is exalated.

Given the stormy weather in Belgium today, I had some time to write up an article which I wanted to do for quite some time.

We got sometimes the question from our users how to automatically exalate all subtasks whenever an issue is being exalated

Exalate is an issue sync solution allowing to integrate between Jira, ServiceNow, SalesForce, Zendesk, ... - (and yes - I'm part of the team building that addon).

 

Therefore I thought to implement this requirement with ScriptRunner ...

The article shows how the exalate classes can be instantiated to trigger an exalate operation.



The way it works is

  • Whenever an exalate operation is finished, a 'Exalate' issueEvent is raised
  • A ScriptRunner custom listener picks up the issue event
  • The custom listener will for each subtask on the issue trigger a new exalate event

 

Setting up the custom Listener

An image is worth 1000 words.  The event the listener needs to listen to is 'com.exalate.api.domain.trigger.EXALATED' 

image.png

 

How does it work in detail


The whole script code can be found on this snippet

 

 

event.issue contains the parent issue which has been exalated.  The exalateNow function is called on every subtask



image.png

The exalateNow function is a closure taking an issue object and a connection name.

image.png

 

  • On line 26 - the connection that needs to be used to exalate the subtask is looked up, An error is raised if the name is not found
  • On line 33 - an exalate issue key is generated,
  • On line 36 - the outgoing sync processor is run on the subtask, creating a 'hubIssue' which is the object that will be sent over
  • On line 39, the exalate operation is scheduled (internally it is called Pairing an issue)

 

The exalateNow code is using a couple of classes that need to be instantiated.  
This can be done using the code below

image.png

 

  • Line 6,7 - get the exalate class loader from the PluginAccessor
  • Line 9 - 13 are used to retrieve the classes from the class loader.
  • Line 9 - BasicIssueKey class is used to generate a unique identifier for the issue
  • Line 10 - EventSchedulerService is the exalate service responsible to manage the sync events.
  • Line 11 - a twin is the couple of issues that are related to each other.  The twin trace repository contains all the twins managed by this exalate. It is not used in the code but it can be useful in certain use cases
  • Line 12 - a relation is another name for connection - the relation repository contains all the defined connections
  • Line 13 - the node helper class is used to run the outgoing sync processor

  • Line 15-18 are used to get access to the OSGiComponents

 

 

Wrap up

This article is meant to give an example how to instantiate the exalate classes and use these to perform a more advanced synchronisation case.

 

Using the above logic it is possible to write a procedure to synchronise a complete issue structure (Project -> Epic -> Story) and all related subtasks.


Disclaimer

This example is using non-public api's which will change between different versions of the addon.  Take this into account whenever using the api's to implement production scripts.

The example is an example and there is no guarantee that it would work in your case.  If in doubt - there are 130+ Exalate partners providing professional services to help out. 

3 comments

francis Marketplace Partner Feb 20, 2022

The snippet has also an example of the code that can be inserted in the outgoing sync of the connection (so that it is not necessary to use a script listener)

Hi @francis 

Is there any same way is possible if parent is unsynced, subtask also unsync?

Regards,

Moogambigai G R

francis Marketplace Partner Apr 08, 2022

Yes - there is an UnexalateEvent


> scheduleUnexalateEvent(connection: IConnection, issueKey: IIssueKey)

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events