Create and share filter & board using scriptrunner (JIRA Cloud)

ziad.bakhiet August 13, 2020

Hello,

I'm trying to create a filter & board and share it using scriptrunner (JIRA cloud), I know that it's possible in JIRA server as it's available in the documentation but I can't find anything related to this topic in scriptrunner documentation for JIRA Cloud.

Anyone has already did it in JIRA Cloud ?

Thank you.

2 answers

0 votes
ziad.bakhiet August 14, 2020

Thank you @Kristian Walker _Adaptavist_ for you answer, however I just found a solution, here's the code using scriptrunner in Cloud:

// Search using jql

def jqlSearch = "project in (P1, P2) AND issuetype = Epic order by created DESC"

// Create filter (here the name is Test2)

def filterid=post("/rest/api/3/filter")

    .header('Content-Type', 'application/json')

    .body([

        "jql": jqlSearch,

        "name":"Test2",

    ])

    .asObject(Map).body.id

// Get the filter permission & add the project with id (here the id is 10002)

// We can use "type": "group", "groupname": "site-admins" if I want to give permission to a group

    post("/rest/api/3/filter/${filterid}/permission")

    .header('Content-Type', 'application/json')

    .body([

        "type": "project",

        "projectId": 10002,

        ])

    .asObject(Map)

 

So I'll try to proceed with the same concept for the board creation & will share the code once done.

Thank you

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 14, 2020

Hi Ziad,

Thank you for your question.

I can confirm that Atlassian provides the Create Filter API and you will need to make a  rest call to this API to create a filter inside of your script.

Also I can confirm that, for creating boards that you can make a separate Rest API Call to the Create Board API in order to create a board after you have created your filter.

I do not have any examples of how to use these API's that I can share but would advise using these documentation pages as reference guides and testing your script on the Script Console to figure out how the API's work.

I hope this information helps.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events