How can I determine all the structure boards that are using a particular type of synchronizer?

We have 100's of structure boards and many of them have synchronizers installed. We have built two custom synchronizers and are interested in determining which structure boards are using them. I'm happy to write a script or DB query but can't figure out which API to exploit. I've looked through your REST endpoints to no avail and recall you saying that your derby DB isn't query-able. Am I out of luck?

Thanks!

1 answer

1 accepted

Hello Thomas, thanks for the question! You can get the result by using Structure's Java API. You'll need to install the Script Runner plugin (if you don't have it yet) and use a Groovy script like the following:

// get the services we need
import com.atlassian.jira.component.ComponentAccessor
def plugin = ComponentAccessor.getPluginAccessor().getPlugin('com.almworks.jira.structure')
def structureManager = plugin.getModuleDescriptor('structure-manager').getModule()
def syncManager = plugin.getModuleDescriptor('sync-manager').getModule()


// get all structures (except archived)
def structures = structureManager.getAllStructures(null, null, true)
// find structures having the synchronizers you need
def result = structures.findAll { str ->
  // get all synchronizers for the structure
  def syncs = syncManager.getInstalledSynchronizersForStructure(str.id)
  // check if any of the syncs satisfies the condition
  syncs.any { sync ->
    // in this case, the sync must be enabled and be a FilterSynchronizer
    // adjust the condition as needed
    syncManager.isAutosyncEnabled(sync.instanceId) && sync.synchronizer.class.simpleName == 'FilterSynchronizer'
  }
}


// format the result -- you may need to use <br> as separator for ScriptRunner 3
result.join('\n')

This example script finds all enabled filter synchronzers, so you'll need to adjust the it to find the ones you're interested in.

We also have an online developer guide with a Java API reference, which could be helpful.

I hope this helps. Please write if you have any questions.

Worked like a champ! Thanks!!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

348 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you