How do I create automation exception rules for cloning issue types
Asked by Gary Pallas:

I'm trying to work out how to refine the existing (built in) cloning function for a particular issue type to effectively restrict some fields from being populated to the newly cloned record.

Example - cloning a change request include all fields apart from planned start and end date.

I guess my main challenge here is trying to find the appropriate method of restricting the automation trigger to only apply when issue is created via 'clone' rather than manual creation of new issue. From here I can apply the logic but I can't seem to figure out how to define this particular trigger scenario.

Feels like it will be very obvious but any help would be appreciated.

Thank you


Answers:
author: Tim Kopperud
body: Hi [@Gary Pallas](/t5/user/viewprofilepage/user-id/5042054), welcome to Atlassian Community.

When you clone an issue it will allways create an issue link to the source issue, hence you shold be able to use an automation rule with a **Created** trigger, and then add a filter looking for the **Clones** link type.

This will not work using an **Edited** trigger since the link might have been removed by a user. But when the issue is created the link exists, and can be used as a filter for further processing in the automation rule.

Below the filter within you rule you can then set or remove values from all wanted fields.

TimK

comments: author: Gary Pallas
body: Hi Tim

This sounds promising and exactly the sort of association I was looking for to 'hook into' as the trigger for any honing of clone rules - thanks Tim - I'll give this a go. Appreciate the insight


author: Gary Pallas
body: Struggling a little. It would seem that the clones link type doesn't exist.

To check this further I've tried to use this as a basis in a filter (including 'issueLinkType = clones' into the query) and nothing returns despite there being cloned issues within the wider parameters.

Is this the correct linkage I am looking for?


author: Adolfo Casari
body: [@Gary Pallas](/t5/user/viewprofilepage/user-id/5042054)Try using the Refetch action to make sure the link actually exists after the Issue Created event.


author: Tim Kopperud
body: [@Gary Pallas](/t5/user/viewprofilepage/user-id/5042054), I created a test rule looking like this:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/344723i57554D9F0708AE83/image-size/large?v=v2&px=999 "image.png")

After I cloned a test issue, the audit log shows this::

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/344724iD10B58BAAD598831/image-size/large?v=v2&px=999 "image.png")

Have you tried a setup like the example above?

The correct JQL for finding this manually is

```
issue in linkedIssues(MOBL-57, Clones)
```

So, using this in an automation by JQL should be

```
issue in linkedIssues({{issue}}, Clones)
```

See [JQL functions \| Jira Cloud \| Atlassian Support](https://support.atlassian.com/jira-software-cloud/docs/jql-functions/) for detals on syntax. Also notice **linedIssue** vs **linkedIssues()**. Use the latter in your scenario since the first doesn't utilize the linke type.

But you don't need JQL in the rule as shown in the example rule above.

TimK


author: Gary Pallas
body: Thanks again Tim - yes I tried exactly that rule from your screenshot above and I don't appear to have an option for 'clones' within Link Types drop down. Was this a relationship type that was configured as a pre-cursor? Or was this out of the box? I can look to the JQL as another idea so again thanks for sharing that - appreciated.


author: Gary Pallas
body: There are a few additional options here but clones is not one of them

![Rule Builder.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/345101i5BC1EDB4A8C1902C/image-size/large?v=v2&px=999 "Rule Builder.JPG")


author: Tim Kopperud
body: Hi [@Gary Pallas](/t5/user/viewprofilepage/user-id/5042054) , I suspect the Cloners link type has been renamed or removed from the Issue linking settings.

Please have a look at this KB article [Cloned ticket is not linked to the Parent \| Jira \| Atlassian Documentation](https://confluence.atlassian.com/jirakb/cloned-ticket-is-not-linked-to-the-parent-1283362551.html)

Are you able to try "restoring" the Cloners link type as described in the article?

TimK


author: Luka Hummel - codefortynine
body: Hi [@Gary Pallas](/t5/user/viewprofilepage/user-id/5042054)

If you are having trouble achieving your goal with Jira Automations, you could try our app [Deep Clone for Jira](https://marketplace.atlassian.com/apps/1218652?utm_source=atlassian&utm_medium=referral&utm_campaign=deepj-new-reach-com-2797903). Deep Clone allows you to clone issues and make changes to the data that is being cloned. You can use the [Field Editor](https://documentation.codefortynine.com/deep-clone-for-jira/field-editor?utm_source=atlassian&utm_medium=referral&utm_campaign=deepj-new-reach-com-2797903) feature to edit field values or clear them.

![2024-08-30 14-37.png](https://community.atlassian.com/t5/image/serverpage/image-id/344782iE7FC0B6F76D306C3/image-size/large?v=v2&px=999 "2024-08-30 14-37.png")


author: Tomasz Kowalczyk
body: When you're doing cloning action try to set planned start and end to empty value

comments: author: Gary Pallas
body: Thanks Tomasz - yes this is exactly my thought process for this field - it was the trigger for identifying new issues created by 'cloning' that I was most struggling with. Appreciate your help


Tags: cloud

jira-service-management

jira-service-management-cloud