I found something similar to this, but there was no answer in a year
https://community.atlassian.com/t5/Automation-questions/Create-clone-issue-when-project-name-is-smart-value-dynamic/qaq-p/1494344
Is there a way to Clone a ticket into a project where the target value is passed from the trigger issue and parsed in a smart value? I've attempted this and it returned an error that nothing was provided.
The goal is:
from Jira Service Management i'm trying to keep the current ticket where it is, but if a developer wants to move into a different backlog for a release, they would choose a "Add to Development" transition in the workflow, and the automation would pick up the change to the field "Target Issue Type"
Per other conditions in the automation, the automation would create the clone into a project, which key is passed in from the screen the user selects from. (see screenshot)
it's more scalable for me to add the project keys to the dropdown for the user and pass them to the automation for the smart value to render it and create the ticket into that project.
We have 50+ projects and I don't want to make numerous if/else blocks to accomplish this.
I've tried the smart value for the custom field {{issue."Target Project Key"}} into the project dropdown but I get an error.
Any work around here?
Hi,
It looks like we only accept Project IDs, not keys. I've raised a ticket for this:
https://codebarrel.atlassian.net/browse/AUT-2194
As a workaround you could possibly add the project ID in the drop-down e.g. "JTP [11094]" and then use our String functions to pull it out:
{{issue.Target Project Key.substringBetween("[", "]")}}
Cheers,
Brydie
Thanks I've tried a few variations of this, I just can not get this to work.
Tried:
{{issue.”Target Project Key”.substringBetween(“[“, “]”)}}
{{issue.Target Project Key.substringBetween(“[“, “]”)}}
{{issue.Target Project Key.substringBetween(“(“, “)”)}}
{{issue.Target Project Key.substringBetween(“*“, “*”)}}
Dropdown value as JTP (10938), JTP [10938], JTP *10938*
nothing seems to work although from your suggestion and on
https://confluence.atlassian.com/automation/text-functions-993924863.html
This solution should work fine.
{{issue.Target Project Key}} or {{issue."Target Project Key"}} renders fine, but using in conjunction with the substringBetween() method, it does not for some reason. Should the entire JTP (10938) value be an actual string in the custom field?
Example "JTP (10938)" instead of JTP (10938).
Per this:
https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#substringBetween-java.lang.String-java.lang.String-java.lang.String
This is already coming in a string.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Larry,
What type of field is the "Target Project Key" is it a regular select list? Looks like for select lists we need to grab the "value". I've got the following working for me:
{{issue.Select CF.value.substringBetween("(", ")")}}
Cheers,
Brydie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, this totally works for my case for now while AUT-2194 is being considered to accept keys. Silly me I totally forgot how select menus act in terms of the value :) Appreciate the assist!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Larry,
I was able to do this in Cloud by:
- Creating a custom field to hold my project names and keys. I used a multi-select, since I need the ability to create multiple tickets, but I tested using a single select and it works the same. My naming convention is "TEAM NAME (PROJECT KEY)"
- After my trigger and conditions, I use the "Advanced Branching" option within the "Branch" section to create a new smart value. I call it "project" and it is equal to:
{{#issue.Participating Teams}}{{value.replaceall("(.*)(\()(.*)(\))","$3")}}{{/}}
- Underneath this branch, I have a "related issues" JQL condition to make sure I don't already have a ticket created in this project, linked to this issue using the relationship I use for these, and with the same summary. It checks to make sure there is NO matches to this search:
project = {{project}} and summary ~ "{{triggerIssue.summary}}"
- If this condition is met, I then use a "create issue" action to make the new issue with the field values I want. In the UI dropdown I leave project set to "Same Project" but in the "More Options" expand, I add the following to the "Additional Fields" box:
{
"fields": {
"project":{
"key": "{{project}}"
}
}
}
It would be really nice to be able to just use a smart value directly though - I am not sure if that other ticket survived absorption into Atlassian, so I also put JRACLOUD-78577
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Larry Katz
One work-around for this, albeit a slower one is to use the REST API to get at the Project ID from the name:
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Interesting scenario.
Not sure it can be done as simply as you are thinking (happy and interested in being proven wrong though).
Your "Add to development" screen is kinda as complex as doing a manual cloning process, so....
Best I can think of is:
Replace it with "manual trigger" based automation. This would really simple automation done per Project.
Pros: Easy to copy, edit project and create the next one. So not as hard as a 50 plus if else statement and easy enough to keep adding more as more projects are created
Cons: This would mean 50 plus manual trigger automation rules for people to scroll through. But if they all started with the relevant Project key, then..... Maybe it could work?
It would also be a change in current (I presume) procedure.
It still requires some manual effort (arguably not any more than the "Add to development" screen though) and refactoring to keep in sync with new projects, archived/trashed projects. Again, similar to the maintenance effort of the "Add to development" screen.
Not sure how helpful I've been🤔 ??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Don't know if you absolutely need to find a solution with automation, but there are clone and move apps that are easier to configure and easy for users to use.
For example, Elements Copy & Sync could work for you by letting developers chose a copy recipe "Add to Development" where you've pre-configured the issue type and the user selects from the projects made available for the recipe.
You can see how it works in this video https://youtu.be/uxcOT2imgHQ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.