On this page

Use case

Clone an epic, the tasks under the epic and the sub-tasks of these tasks.

Prerequisites

Create a Text (single line) custom field

Name: Template Issue


Configuration

Add a Create issue post function to the desired workflow transition.

Issue to be created

Mode

Choose Single issue

Issue type

Choose Parser expression (standard issue type) and write the following expression:

%{issue.issueType}

Summary

Enter the following expression with parsing mode set to Basic text

CLONE - %{issue.summary}


Additional options

Update the following fields

Epic Name

Choose Parsed text (basic mode) and write the following expression:

CLONE - %{issue.summary}

Resolution

Choose Parsed text (advanced mode) and write the following expression:

null

Copy remaining fields

Select From current issue and All remaining fields

Add a Relates to issue link and link it to the current issue

Additional options

Tick Store issue keys

Add another Create issue post function after the previous post function in the same workflow transition.

Issues to be created

Mode

Choose Multiple issues

Expression

Enter the following parser expression with parsing mode set to Issue list

issuesUnderEpic()


Issue type

Choose Parser expression (standard issue type) and use the following expression:

^%{issue.issueType}

Summary

Enter the following expression with parsing mode set to Advanced text

^%{issue.summary}


Description

Enter the following expression with parsing mode set to Advanced text

^%{issue.description}

Additional options

Update the following fields

Resolution

Choose Parsed text (advanced mode) and write the following expression:

null

Choose Field in current issue and Ephemeral String 3

Template issue

Choose Parsed text (advanced mode) and write the following expression:

^%{issue.key}

Copy remaining fields

Select From seed issue and All remaining fields

Additional options

Tick Store issue keys

Add another Create issue post function after the previous post function in the same workflow transition.

Issues to be created

Mode

Choose Multiple issues

Expression

Enter the following parser expression with parsing mode set to Text list

toStringList(toString(textOnStringList(toStringList(replaceFirst(%{00063}, "^([^,]+,\\s)", ""), ","), toString(textOnStringList(fieldValue(%{issue.cfTemplateIssue}, issueKeysToIssueList(^0%)), findModify(toString(subtasks(^1%)), "[^, ]+",^0% + ":" + ^2%))))), ",")
Replace the field code %{issue.cfTemplateIssue} with the field code of the Template Issue field in your instance.

Issue type

Choose Selected issue type and select Sub-task

Parent issue

Select Set parent manually (parser expression) and use the following expression.

replaceFirst(^%, ":.*$", "")

Summary

Enter the following expression with parsing mode set to Advanced text

toString(fieldValue(%{00000}, issueKeysToIssueList(replaceFirst(^%, "^.*:", ""))))


Description

Enter the following expression with parsing mode set to Advanced text

toString(fieldValue(%{00001}, issueKeysToIssueList(replaceFirst(^%, "^.*:", ""))))

Additional options

Update the following fields

Assignee

Choose Parsed text (advanced mode) and write the following expression:

toString(fieldValue(%{00003}, issueKeysToIssueList(replaceFirst(^%, "^.*:", ""))))

Due date

Choose Parsed text (advanced mode) and write the following expression:

first(fieldValue({00012}, issueKeysToIssueList(replaceFirst(^%, "^.*:", ""))))

In this case we cannot use the Inherit field values parameter in the post-function for the creation of sub-tasks. Instead, we must use a different expression for each field that we want to copy into sub-task's clones. The expressions to be used are the following ones.

For Number and Date-Time fields:

first(fieldValue({issue.cfTemplateIssue}, issueKeysToIssueList(replaceFirst(^%, "^.*:", ""))))


For the rest of the fields:

toString(fieldValue(%{issue.cfTemplateIssue}, issueKeysToIssueList(replaceFirst(^%, "^.*:", ""))))
Replace the field code %{issue.cfTemplateIssue} with the field code of the Template Issue field in your instance.



If you still have questions, feel free to refer to our support team.