Skip to main content
Skip table of contents

Clone and Edit With Jira Expressions

The field editor supports using Jira expressions for dynamically setting field values.

About Jira Expressions

The following documentation is available to learn more about Jira expressions:

Using Jira expressions is an advanced way of editing fields and may require some technical knowledge. If you have any trouble implementing your use case with Jira expressions, please let us know.

Using Jira Expressions in the Field Editor

Select the Jira expression operator in the Field Editor. A text area will appear, where the Jira expression can be entered.

A Field value preview is also available, so you can verify the result of the expression for each issue. The issues shown in the preview can be filtered with JQL. You can learn more about JQL in the JQL reference.

Examples

Jira expressions are very powerful and can be used for a lot of different use cases. In this section, we will present what we think are the most common use cases for editing fields with Jira expressions.

Copy the value of a field to another field

If the source project and the target project use two different fields for the same purpose, you might want to copy the value of a field in the source issue to a different field in the created issue.

In the example below, the field Contact person is set to the assignee of the original issue.

You can also reference custom fields by using the format issue.customfield_10123. The Add field dropdown can be used to figure out the identifiers of the different fields to be used in Jira expressions.

Based on the screenshot below, the Epic Status field can be referenced with issue.customfield_10012, and the Fix versions field can be referenced with issue.fixVersions.

Combine and copy the value of multiple fields

If the source issue has fields that the target project does not provide (for example, when cloning a Jira Service Desk ticket to a regular Jira project), you might want to combine all these fields in the description of the created issue, in order to not lose any information.

Edit a field if a condition is met

You can edit a field if certain conditions are met in the source issue. In the example below, all cloned “Story” issues will retain their assignee, while issues that are not of type “Story” will be assigned to the user with id 5e12c0c53504f30cabe3d391.

Dynamically edit date fields

Date fields can be set to the current date/time during the cloning process.

You might also want to edit date values, e.g. add two days to all “Due date” values in the created issues.

Clone Multiple Times index

If you are using the option Clone Multiple Times, you can use the variable cloneMultipleTimesIndex in the Jira Expression. You do not have to declare the variable yourself in the Jira expression, as it is usually done.

For the first issue created, cloneMultipleTimesIndex will have a value of 1, and then increase by one for every subsequent issue created.

In the example below, we choose to clone an issue 12 times (once for each month of the year).

Then, we use the cloneMultipleTimesIndex variable to set increasing Due Dates in the created issues, based on the Due Date of the issue being cloned.

Reference the user doing the clone

To reference the user doing the clone (similar to currentUser() in JQL), you can use the variable cloneUser.

The variable provides the following properties:

  • accountId: The cloning user account ID (String).

  • active: Whether the account is active (Boolean).

To get for example the display name of the cloning user, you can use the following expression:

CODE
new User(cloneUser.accountId).displayName
Screenshot 2024-03-08 at 10.50.20.png

Please note that in the case of Post Function Clone, the cloneUser will be the user triggering the Post Function. This is the same user that can be seen as the clone job owner in the Clone History.

Replace assignees based on their account ID

You can replace issue assignees by other users based on their account IDs. This can be useful for example when cloning to another instance, and some users have different account IDs in the target instance.

The example below will replace assignees with account ID 1 by the user with account ID 2, and the assignees with account ID 3 by the user with account ID 4. Otherwise, the assignee will be kept. The same expression works for any other user-based field.

Screenshot 2024-11-21 at 15.52.54.png

Troubleshooting

Unrecognized property

The error “Unrecognized property” may be returned, along with the list of available properties. You can go through this list to find the correct format for the property you are trying to use.

In the example below, the property Assignee is not recognized, but going through the list, one can see that the expected format is actually assignee (Jira expressions being case-sensitive).

Limitations

Validation

Deep Clone for Jira does not validate whether Jira will accept the provided expression or not. If the expression provided is erroneous, you will still be able to start the cloning process, and the field will not be set in the created issues, as the Jira expression could not be evaluated.

Supported fields

The following fields can not be edited with Jira expressions:

  • Comments

  • Epic Link

  • Issue Links

  • Sprint

  • Watchers


Install Deep Clone for Jira

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.