Hi, can you please tell me if it is possible to clone a task from project A into a newly created project B through automation? I tried to do it through the trigger The project was created, but I don't understand how to proceed.
Hi @Potip Serhii , as mentioned in the documentation, you definitely can:
Creates a duplicate of an issue within the same project or a project of your choosing.
I'm going to guess that if you don't see the option to choose another project to clone from, then your Rule is probably scoped to a single project. You can change this from Single to Multiple or All projects in the Details for your rule, as described here:
https://support.atlassian.com/cloud-automation/docs/create-and-edit-jira-automation-rules/
The Scope option looks like this:
Thank you very much for your answer, here is what I do: https://www.screencast.com/t/0yOuL7mGj8a1. I create a project2. I check that I am creating the project3. I find a task1 in a pre-created projectNow I need to clone the found task1 into the created project, I don’t understand how to do it.
Thanks for the screenshot!
So is Author the same as Initiator? I assume so.
So I think you won't be able to use the actual Clone Action because that always uses the "current issue" as the source of the clone.
But what I think you *should* be able to do is Create a new issue in the new project with the looked up data. To avoid any problems (like finding multiple issues with the same summary), I would specify an exact issue for your JQL lookup, like so:
issue = BT-1
Then it's just a matter of Creating the issues with all of the fields set, or probably just the fields you care about, populating them with the corresponding fields from the issue you looked up, using the {{lookupIssues}} smart value. Since searching for an exact issue should only return one result, we can use {{lookupIssues.first}} to retrieve field values from the first (and only) issue.
This would look something like this:
NOTE, I was unable to to save my test rule when I tried to include a check for Initiator (Author).
So I had to do that check on {{project.lead.displayName}} which isn't great, but the {{project}} Smart Value does not appear to include information on who created a project.
So I didn't like having to make @Potip Serhii manually choose every field to copy, so I started thinking about whether I could "clone" an issue by pulling the data from an API call to get all the field data in JSON format and then just plopping that into Additional fields in the Create action and lo and behold... it works (even though the rule complains about invalid JSON).
(@Bill Sheboy you might get a kick out of this)
Here's what that looks like:
For information on what this API Web Request is about, and how to generate your own Authorization Header, take a look here at this article:
To explain a bit more about what I'm doing, I'm using Automation to make a call to Jira's REST API, which conveniently returns values for every field for the issue I request (BT-1), in a format (JSON) that can then be plopped right into the Automation's Create action's Additional fields.
Hi - I saw you were having some problems.
Hm now that I know what your trying to do, maybe change the Scope back to All or maybe Projects of specified type (Software development)?
Hey, @Darryl Lee
That's quite clever, and...how many of the fields did you check?
I wonder about fields which are either not supported in the REST API or which have some typing issues between get/write motion. I suppose this could be validated by comparing the new issue's JSON with the source (outside a rule or inside).
Thanks, and best regards,Bill
Who me, validate my rule? Haha. :-}
OOOF, I realize now that I don't think my hack was actually working, or at least not fully. The other rule was still running. ODDLY though, for a while TWO tickets were getting created for each new project. Hmmm.
It looks like you're new here. Sign in or register to get started.