Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation to clone issues from project A to project B Getting Error

Tempo Digital
Contributor
November 3, 2023

Hello,

I'm trying to clone an issue from project A to B with a Transition Issue trigger. But I got some error messages like:

Can not create issue in project/issue type

10012/10027

 

Any suggestions/solutions?
Thank you

Error Jira.png

2 answers

0 votes
Hadas Hamerovv
Contributor
August 29, 2021

Ok. Here is how we managed to do that:

1. Create a script listener and set the triggering event for a 'sprint start'

2. In the Script Context console write the following:

NOTE - Replace the following strings to your own ones:

'your-project-key' - to your project key name

'IssueType' - to the issue type you are trying to add (i.e Bug, Feature, Task etc.)

summary and description - write whatever you want. In our case we added the sprint name to the issue name thus you see the @$sprintName

Hope This helps

 

def projectKey = 'your-project-key'
def projectId = get("/rest/api/2/project/${projectKey}").asObject(Map).body.id

def taskType = get("/rest/api/2/issuetype/project?projectId=${projectId}").asObject(List).body.find { it['name'] == 'IssueType' }['id']
def sprintName = sprint.name


post("/rest/api/2/issue")
.header("Content-Type", "application/json")
.body(
[
fields: [
summary : "$sprintName - task-name",
description: "Commit all the subtasks which are done in $sprintName (Bug fixes and New Features) to Staging",
project : [
id: projectId
],
issuetype : [
id: taskType
]
]
])
.asString()

0 votes
Hadas Hamerovv
Contributor
August 27, 2021

Wow, I have the same problem and can't figure out how to code this. I am reading all the ScriptRunner tuts and still am confused. Will let you know if I manage to do that

Suggest an answer

Log in or Sign up to answer