Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Choosing which project(s) to create issues in using a custom label field

I have a similar question to https://community.atlassian.com/t5/Automation-questions/Create-clone-issue-when-project-name-is-smart-value-dynamic/qaq-p/1494344. I'm using Automation for Jira to create new items and dynamically selecting the board(s) on which new item(s) should be made using a custom labels field. That looks like this:-

ExampleRuleConfiguration.JPG

The comment action is only for debugging purposes which confirms that the smart value does indeed contain the key of a valid project. However, when the rule attempts to create an item in this project, the Create Issue action returns the following error- 

Error creating issue
Specify a valid project ID or key (project)

Is this a bug in the the way the automation is implementing the Create Issue API method? I'm assuming that the Create Issue action would default to trying to create with "key" : {{productSuite}} instead of "id" : {{productSuite}} if the value is non-numeric but is this actually the case? I tried using the project's ID instead and this successfully created the item.

2 answers

0 votes
Curt Holley Community Leader Sep 27, 2021

So {{productSuite}} equates to a custom field with the Keys of certain other Projects as it's values, is that right?
Then you want the automation to use whatever is in that field as the destination project of the Bug the automation is creating....I'm I still on the right path here??

If so, wouldn't be {{issue.productSuite}} or {{triggerIssue.productSuite}} ?

{{productSuite}} is a variable produced by the Advanced Branching branch that the actions are being executed within-

AdvancedBranching.JPG

The {{issue.PRODUCT SUITE}} field is a custom label field. I'm branching like this so that for each label, the branch will be executed.

Like Curt Holley likes this

I have a really hacky workaround for this which really makes me think that this is a bug in the way the automation is implemented. By using the Lookup Issues action I can find items using the project key and then use the project id from a lookupissue to create an item.

HackyWorkaround.JPG

I don't really like this solution though!

One extra note on this- when Lookup Issues returns multiple items, the resultant string constructed in {{lookupIssues.project.id}} is a comma separated list of the id of all of the items. Instead, I used {{lookupIssues.first.project.id}} which functions correctly regardless of how many items exist in the target project.

Allen Samson Atlassian Team Sep 29, 2021

Hi there,

This looks like a tricky problem that we’ll need to look at more closely. It’s best if you raise this problem through the support portal at https://getsupport.atlassian.com/ and we can get a closer look.

Cheers,
Allen

Hi Allen,

Having investigated this further, I'm fairly sure there is an issue along the following lines-

  • Automation for Jira exposes the ability create items via the Create Issue API https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post
  • This method requires that a valid key or id for the target project is set (hence the error that is passed back to me, the user, when the automation fails)
  • Automation for Jira's implementation of this API method is such that it will always specify project by id
  • When creating an issue by "key", the key is only being displayed in the GUI when in fact the back-end post to the Jira API is using the id

ie. Creating an issue from key is not possible in the Create Issue method within Automation for Jira.

I am not a site administrator in my org so cannot raise support requests to Atlassian. Does this need to follow that process in order to be raised to a backlog for the product? I don't expect that this is a large enough concern that it will be fixed so I am already looking at ways to work around the problem.

Like Curt Holley likes this
Curt Holley Community Leader Sep 30, 2021

Nice one @Callum Clarke  that makes sense.

You could likely workaround this by If/else statements around each potential result from your variable and then put each corresponding Project key in place in the Create issue action. 

But that sounds a bit tedious :-(

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

153 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you