How can I share a board with project by scriptrunner? Edited

Hi all!


I wrote a groovy code in scriptrunner which is genererate a project with scrum board. It is a post-function because project generated from issue. It has got one problem. When I delete the project, then board still exist. So I figured it out that when I generate again project then code won't make another board, just share with project. I searched on internet last whole day, but I didn't find similar issue. I tried to delete the board what was successful but its filter still exsist and it somehow caused some problem when I generate an I read the script runner's sources: https://scriptrunner.adaptavist.com/latest/jira/scripting-other-plugins.htmlhttps://scriptrunner.adaptavist.com/latest/jira/plugins/working-with-jira-agile.html
How can I share a board with project by scriptrunner? I would like to fill out this field with project by scripting.

Capture.PNG

I am using the following versions: JIRA v6.4.10 (server); JIRA Agile v6.7.0 ; Adaptavist ScriptRunner for JIRA 4.1.3.24

Thank you in advanced!

 

UPDATE:

Related issue: https://community.atlassian.com/t5/Answers-Developer-Questions/JIRA-Java-plugin-ProjectService-createproject-creates-project/qaq-p/513836?posted=614874#U614874

1 answer

1 accepted

0 votes
Accepted answer

Hello guys, I did it! :) But I got another problem... I set the filter's share. It is okey, after that on project view the board is not appear. I found a solution, what is cache clear. Is it safe?
Code: 

ComponentAccessor.getProjectManager().refresh()
ComponentAccessor.getComponent(EventPublisher.class).publish(ClearCacheEvent.INSTANCE)

 It seemed long to run. Is it okey? (On my Sandbox Jira server)
Our official server is bigger with more projects, then If I use this, it will be more longer?

 

Picture about not-showing-board-place:

Capture.PNG

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,438 views 0 8
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