Forums

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

Can i create or clone an issue with a dynamic project key?

Juergen Koeck
Contributor
December 5, 2024

So i want to clone or create a new issue with the same data in a different project. just like  this:
CloneorCopy.jpg

 

But i always get an Error: 

 

Error creating issue
Specify a valid project ID or key (project)
Issue was created successfully, however some unexpected errors occurred -

Is this possible, do i have to do this via a REST Call or is there a workaround?

3 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2024

Hi @Juergen Koeck 

For a question like this, context is important for the community to help.  Please post the following:

  • what type of project is this (e.g., company-managed, team-managed, etc.), 
  • an image of your complete automation rule,
  • images of any relevant actions / conditions / branches,
  • an image of the audit log details showing the rule execution, and
  • explain what is not working as expected.

Until we see those...

I believe the project id value may be provided to create the issue dynamically.  For example:

  • create a variable named varProjectId
  • type {{varProjectId}} in the Project field for the Create Issue (or Clone Issue) action
  • when it appears below the field, select it for use to create the issue

Kind regards,
Bill

Juergen Koeck
Contributor
December 6, 2024

Hi @Bill Sheboy 
so here are the Details:

  • Company-Managed-Project
  • Audit Log and all the relevant Details:AuditLog.pngCloneIssue.pngCreateNew Issue.pngGetProjectKey.png
    FullAtutomaion.jpg

 

So the cloning and creating a new issue doesnt work.
The Project key is also correct

Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2024

Hi @Juergen Koeck 

If you add a log action after creating the variable and log the content of the variable.

is this a correct project Key, I suspect so by your mention.

But I think the issues is this text and the project option in the clone and create acton need an value, as the project field is not text.

By using these conditions normally, you will start typing and based on your input a project can be selected. This is an ID.

So in you automation you would need to use the variable to find the correct ID of a project and you that as input

Al theoretically of course :)

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2024

There is an existing smart value named project, and so it is certainly possible the rule is getting confused by your variable name.  I recommend always adding a prefix to variable names to avoid problems, such as with varProjectId

 

And as Marc and I have described, you must use the project ID and not the project Key to dynamically select the project for issue creation.

Juergen Koeck
Contributor
December 9, 2024

Hi @Marc - Devoteam ,
your theory worked exactly like you predicted.

It worked after querying for the correct ID via the Rest API

Thanks!

Like Marc - Devoteam likes this
0 votes
Luka Hummel - codefortynine
Atlassian Partner
December 12, 2024

Hi @Juergen Koeck,

If you are encountering problems with your cloning automation, and you are willing to try a third-party app, you can try our app Deep Clone for Jira. Deep Clone allows you to clone issues across projects, including bulk cloning and adjusting fields dynamically, without needing complex automation rules.

0 votes
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2024

Hi @Juergen Koeck 

If you want to clone an issue into another project, you need to specify the project where the issue needs to end up.

This is not dynamically possible.

Juergen Koeck
Contributor
December 5, 2024

Hi,
thanks for the reply,
so i need to make a REST call to clone the issue in another project, which does the exact same thing, except its a bit more tricky?

This should work or am i wrong?

Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2024

No API can't do this as well.

You need to specify the project key or project name where the clone needs to end up.

This doesn't matter if you use automation or API

You can't use a dynamic project key.

You could make a lookup table in your automation and based on the id from the table you will have a value (set these values as project keys)

Based on if/else options in a rule the issue would get created in the related project.

This can only be done with a manual rule where you ask an input value

Then compare this value with a value from the lookup table

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events