> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/ticketing-systems/update-jira-issues-in-cd-stages.md).

# Update Jira issues in CD stages

This topic describes how to update a Jira issue using the Update Jira step.

You can add the Update Jira step to a Harness CD stage or an Approval stage.

You can also [update Jira issues](/continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/ticketing-systems/update-jira-issues-in-cd-stages.md) and [add Jira approval stages and steps](/harness-ai/use-harness-platform/approvals/adding-jira-approval-stages.md).

### Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

* [Connect to Jira](/harness-ai/use-harness-platform/connectors/ticketing-systems/connect-to-jira.md): You can add a Harness Jira connector before or during the Create Jira step setup.
* [Adding Jira approval stages and steps](/harness-ai/use-harness-platform/approvals/adding-jira-approval-stages.md)

### Limitations <a href="#limitations" id="limitations"></a>

* Harness supports only Jira fields of type `User`, `Option`, `Array`, `Any`, `Number`, `Date`, and `String`. For example, [multi value](https://support.atlassian.com/jira-cloud-administration/docs/custom-fields-types-in-company-managed-projects/) fields to allow users to select multiple options from a drop-down list.
* Harness does not integrate with Jira fields that manage issue links or attachments.
* The Jira Update step manages standard Jira issue fields. It does not update the **Deployment** or **Build** fields under the **Development** tab on Jira issues. To update those fields, use the [Jira Plugin step](/continuous-integration/use-harness-ci/use-harness-ci/use-drone-plugins/ci-jira-int-plugin.md#how-does-harness-determine-which-jira-field-to-update) in your pipeline.
* You can add unsupported Jira fields using an HTTP step. For more details, go to [Use the HTTP step to set unsupported fields when creating Jira issues](/continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/ticketing-systems/create-cascading-fields-jira.md).

### Add a Jira Update step <a href="#add-a-jira-update-step" id="add-a-jira-update-step"></a>

1. In a Harness CD or Approval stage, in **Execution**, select **Add Step**.
2. Select **Jira Update**. The Jira Update step appears.

   ![](/files/Dycv81udDA4LgJeyj7b3)
3. In **Name**, enter a name that describes the step.
4. In **Timeout**, enter how long you want Harness to try to update the issue before failing (and initiating the stage or step [failure strategy](/harness-ai/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md)).
5. In **Jira Connector**, create or select the [Jira connector](/harness-ai/use-harness-platform/connectors/ticketing-systems/connect-to-jira.md) to use.
6. In **Issue Key**, enter the Jira issue key of the issue you want to update.
7. Select **Apply Changes**.
8. Select **Save**.

### Use an expression in Issue Key <a href="#use-an-expression-in-issue-key" id="use-an-expression-in-issue-key"></a>

In **Issue Key**, you can use an expression or runtime input to reference the Key ID from another Jira Create or Jira Update step.

Here are some important considerations when using an expression in **Issue Key:**

* The Jira Create or Jira Update step you want to reference must be before the Jira Update step that references it in the stage.
* Harness uses the **Jira Project** and **Issue Type** you select in **Add Jira Fields** to fetch the list of fields. If you use a runtime input or expression for **Issue Key** and the Jira Project and Issue Type you selected does not correspond with the issue key resolved at runtime, your pipeline could fail to execute successfully.

To use an expression in **Issue Key**, do the following:

1. Identify the step where you want to get the ID from. In this example, we'll use a Jira Create step.

   You'll have to close the Jira Update step to get the ID from the previous step. An ID is required, so you can just enter any number for now and click **Save**. In the pipeline, select **Execution History**.
2. Select a successful execution, and click the Jira Create step in the execution.
3. Select the **Output** tab, locate the **Key** setting, and select the copy button.

   ![](/files/wkpGaEqdy2HN6X13GGXM)

   The expression will look something like this:

   `<+pipeline.stages.Jira_Stage.spec.execution.steps.jiraCreate.issue.key>`

   Now you have the expression that references the key ID from this step.
4. Go back to your Jira Update step. You can just select **Edit Pipeline**.
5. In **Issue Key**, select **Expression**.

   ![](/files/Ffx8vDnIJ4X4Kcdrs1a0)
6. In **Issue Key**, paste in the expression you copied from the previous Jira Create step.

   Now this Jira Update step will update the issue created by the Jira Create step.

   Some users can forget that when you use a Jira Create step it creates a new, independent Jira issue every time it is run. If you are using the same issue ID in Jira Update, you are updating a new issue every run.

### Optional configuration <a href="#optional-configuration" id="optional-configuration"></a>

In **Optional Configuration**:

* * In **Status**, enter the status type (Issue Action) to update the issue with (In Progress, Done, etc). Harness will automatically update the issue with this status.
* * In **Transition Name**, enter the name of the transition to move the issues into (for example, `Transition to`, `PR Testing`, `Ready for Test`).

If the issue is not part of a Jira workflow and does not have transition options, then the step will fail. For more information, go to [statuses and transitions](https://support.atlassian.com/jira-cloud-administration/docs/work-with-issue-workflows/#Workingwithworkflows-steps) from Atlasssian.

### Add Issue fields <a href="#add-issue-fields" id="add-issue-fields"></a>

You can select specific fields to update within a Jira issue. For more information, go to [Jira custom fields](https://support.atlassian.com/jira-cloud-administration/docs/custom-fields-types-in-company-managed-projects/).

Review the [limitations section](#limitations) to know more about the supported issue fields and limitations.

#### Referencing JIRA fields with spaces or special characters in expressions <a href="#referencing-jira-fields-with-spaces-or-special-characters-in-expressions" id="referencing-jira-fields-with-spaces-or-special-characters-in-expressions"></a>

When you need to reference JIRA custom field values using Harness expressions (for example, in conditional execution, approval criteria, or when passing values between steps), fields that contain spaces or special characters must be enclosed in **single quotes** (`'`).

**Examples:**

**Fields with spaces - Correct syntax:**

```
<+pipeline.stages.Jira_Stage.spec.execution.steps.Jira_Update.issue.'Risk Level'>
<+execution.steps.jiraUpdate.issue.'Custom Field'>
```

**Fields without spaces - No quotes needed:**

```
<+execution.steps.jiraUpdate.issue.Status>
<+execution.steps.jiraUpdate.issue.Priority>
```

**Using in conditional expressions:**

```
<+execution.steps.jiraUpdate.issue.'Risk Level'> == "High"
```

{% hint style="info" %}
When referencing JIRA issue fields updated by the Jira Update step in subsequent steps or expressions, remember to use single quotes around field names that contain spaces or special characters.
{% endhint %}

In **Optional Configuration**, select **+ Fields** to add Jira fields.

![](/files/TwbWcgzGHJ9Rid5sNWGX)

### Jira Date field support <a href="#jira-date-field-support" id="jira-date-field-support"></a>

Among the custom fields Harness supports are Baseline End Date and Start Date Time. If your Jira project uses these fields, they are available in Fields:

![](/files/m8mf7QS68qeCQ8L5Vtm2)

Once you have selected these fields their settings appear.

![](/files/RzLVm96Uoomb2AMmb50x)

You can also use advanced dates using stage variables and the `current()` function. For example:

* `<+currentDate().plusDays(2).plusMonths(1)>`: current date plus one month and two days.
* `<+currentTime()>`: for current date time fields.

Harness supports the following functions.

For date-only fields:

`currentDate().plusYears(1).plusMonths(1).plusWeeks(1).plusDays(1)`

For date and time fields:

`currentTime().plusYears(1).plusMonths(1).plusWeeks(1).plusDays(1).plusHours(1).plusMinutes(1).plusSeconds(1).plusNanos(1)`

The number 1 is used as an example. You can add whatever number you need.

### Update Issue Type field support <a href="#update-issue-type-field-support" id="update-issue-type-field-support"></a>

Harness supports updating the Jira Issue Type.

1. Enter an **Issue Key** in the Jira Update step.
2. In the **Add Jira Fields** dialog, select **Issue Type**, then select **Add**. The **Issue Type** field appears under **Optional Configuration**.

   ![](/files/fUDwnQbWg8rEuAcAOYMc)
3. Select a new issue type to modify the Issue Type of the selected Jira issue, and select **Apply Changes**.

   ![](/files/khU5E1alaMrpTCVGnyx5)

The issue type for the selected Jira Issue is now updated with the issue type you selected.

### Update Jira Deployment or Build fields <a href="#update-jira-deployment-or-build-fields" id="update-jira-deployment-or-build-fields"></a>

The **Deployment** and **Build** fields under the **Development** tab on a Jira issue are managed through the Jira Development API. This is separate from the standard Jira issue fields API that the Jira Update step uses.

If you select the **Environment** field in the Jira Update step's **Add Jira Fields** dialog, it updates the standard Jira **Environment** field on the issue. It does not update the **Deployment** or **Build** fields under the **Development** tab.

To update the **Deployment** or **Build** fields, use the **Plugin** step with the `plugins/jira` image instead. The `ENVIRONMENT_NAME` setting in the Plugin step controls which field is updated:

* **With `ENVIRONMENT_NAME`:** Harness updates the Jira **Deployment** field.
* **Without `ENVIRONMENT_NAME`:** Harness updates the Jira **Build** field.

For setup instructions, go to [Integrate Jira in a CI pipeline](/continuous-integration/use-harness-ci/use-harness-ci/use-drone-plugins/ci-jira-int-plugin.md#how-does-harness-determine-which-jira-field-to-update).

{% hint style="warning" %}
Do not confuse the standard Jira **Environment** field with the **Deployment** field under the **Development** tab. Setting the Environment field in the Jira Update step only updates the issue-level Environment field, not the Development tab's Deployment tracking.
{% endhint %}

### Advanced settings <a href="#advanced-settings" id="advanced-settings"></a>

In **Advanced**, you can use the following options:

* [Delegate Selector](/harness-ai/use-harness-platform/delegates/delegate/manage-delegates/select-delegates-with-selectors.md)
* [Conditional Execution](/harness-ai/use-harness-platform/pipelines/step-skip-condition-settings.md)
* [Failure Strategy](/harness-ai/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md)
* [Looping Strategy](/harness-ai/use-harness-platform/pipelines/looping-strategies/looping-strategies-matrix-repeat-and-parallelism.md)
* [Policy Enforcement](/harness-ai/use-harness-platform/governance/policy-as-code/harness-governance-overview.md)

### Apply and test <a href="#apply-and-test" id="apply-and-test"></a>

Select **Apply Changes**. The Jira Update step is added to the stage.

Run the pipeline.

In the pipeline execution view, select the **Jira Update** step, and then select the **Output** tab.

You can see all of the fields for the new Jira issue you created.

Locate **URL** and copy its value.

![](/files/tIKfjRiMSntxQMv8kjcG)

In a new browser tab, paste the URL and press enter.

The updated issue appears in Jira.

### Parent issue support <a href="#parent-issue-support" id="parent-issue-support"></a>

Harness supports parent links (the `issuelink` field in Jira).

This support enables you to do the following:

* The Jira Create step can now be used to create issues with existing issues as their parent.
* The Jira Update step can be used to update the parent of a specific issue.
* A sub-task can be created using the Jira Create step.
* A ticket parent can be provided by simply typing the parent issue key in **Parent** setting, such as `TJI-47890`.

To use parent links, do the following:

1. In the Jira Create or Update step, select **Optional Configuration**.
2. Select **Fields**.
3. In **Add Jira Fields**, select **Parent**, and select **Add**.

   ![picture 1](/files/tdzpcJAx9JIVLA3MhsH6)
4. In the **Value** for **Parent**, add the parent issue key.

   ![picture 2](/files/kKYg8yGEaTLZ5rkn1ogw)
