Create Agile Boards in JIRA via Groovy Script

Is it possible to create agile boards using groovy through the jira script console (scriptrunner)?

import com.atlassian.greenhopper.manager.rapidview.RapidViewManagerImpl

...

def rapidviewManager = new RapidViewManagerImpl()

//When I call this (or any other method from rapidviewmanager) it gives error
rapidviewManager.create(myRapidView, admin, RapidViewPreset.KANBAN)

 I get the following error:

Script console script failed: java.lang.NullPointerException at com.atlassian.greenhopper.manager.rapidview.RapidViewManagerImpl.get(RapidViewManagerImpl.java:515) at com.atlassian.greenhopper.manager.rapidview.RapidViewManager$get.call(Unknown Source)

The same happens when I try using RapidViewService. I am using JIRA 7. Is it not supported, or am I missing something? Thanks in advance!

1 answer

1 accepted

0 vote
Jenna Davis Community Champion Aug 28, 2017

Hello,

Try importing the class using this:

def rapidViewManager = ComponentAccessor.getComponent(RapidViewManager)

If you're still having problems after trying this, could you please send the entire script your using and I'll have a look at it?

Regards,

Jenna

Hi Jenna, thanks for your reply.

There's not much to the rest of the script, I just create a rapidview, declare an admin user, and imported the RapidPreset class. I don't think it's an issue with any of the parameters as I have tried many methods from the RapidViewManager class (such as .get()) but all of them give nullpointererror (The rapidviewmanager itself is not null.)

I have tried using ComponentAccessor, but the object it returns is null. Defining it with RapidManagerImpl() is the only way I've been able to get a non-null object. 

Jenna Davis Community Champion Aug 30, 2017

Using the format I gave above, I'm able to access everything and get methods to run from the class just fine.

Even if there isn't much to your script, could you send it just so I can check it out?

Jenna Davis Community Champion Sep 06, 2017

Just a side note, there is a section in the documentation that covers creating agile boards that I hadn't mentioned earlier. You might find the information you're looking for there if my comments didn't help. :)

https://scriptrunner.adaptavist.com/latest/jira/plugins/working-with-jira-agile.html 

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

77 views 0 5
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