# Automatically Create Jira Issues for New Tickets

This document explains how to set up an automated workflow to create Jira issues for new tickets based on specified criteria.

## Use Case

For example, you may want to create a Jira issue for any new ticket with potential savings of $500 or more in OneLens. This workflow will automatically create a Jira issue for tickets that meet this threshold.

{% hint style="success" %}

### Prerequisite

Before setting up this workflow, ensure that your Jira instance is integrated with OneLens. For integration details, click here.
{% endhint %}

## Video Guide

For a more detailed walkthrough, refer to the video guide available here.

{% embed url="<https://youtu.be/toUCge_o97U>" %}

## Step-by-Step Guide

{% stepper %}
{% step %}

### Access the Workflows

1. Navigate to the **workflow** section of OneLens.
2. Click the **Create** button in the top-left corner to start a new workflow.

<figure><img src="/files/HjJmmwYEMfMdN3zzCLXg" alt="" width="563"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Create a New Workflow

1. A dialog box will appear asking for a workflow name. Enter a descriptive name (e.g., Create Jira Issue for High-Value Tickets).
2. You can also add a *description*, which is optional.
3. Once you’ve filled in the details, click **Create** to proceed.

<img src="/files/wSRSEOj7fpdCfnX4pTTJ" alt="" width="563">
{% endstep %}

{% step %}

### Choose the Trigger

1. In the workflow setup, select the **Tickets** option as your trigger.
2. For this scenario, choose **Ticket is Created**, as you want to trigger the workflow when a new ticket is generated.

   <figure><img src="/files/SB8qBJJ130SXrNh5tGGT" alt="" width="563"><figcaption></figcaption></figure>

#### **Trigger Start**

* You’ll have two options for how these conditions should be applied:
  * **Trigger when all conditions match** – the workflow will only trigger if all conditions are met.
  * **Trigger when any condition matches** – the workflow will trigger if any one of the conditions is met.
* You can configure multiple conditions by clicking on the **Add Rule** button.

<img src="/files/VgN44pMcljmvXJJI1kK4" alt="" width="563">

#### **Condition Configuration**

Each condition involves filling out three fields:

1. **Criteria**: Choose the specific property of the ticket you want to filter by. You can use the following attributes:
   1. **Ticket**: Status, Category
   2. **Recommendation**: Potential Savings, Effort
   3. **Resource**: Name, Account, Region, Service, Tags
   4. **Cost Center (Org Hierarchy)**: Cost Center, Category
   5. **Policy**: Name, Category
2. **Limit**: Set a comparison operator or criteria type for the selected attribute. The available options vary based on the chosen criteria.
3. **Borderline**: Set the specific value or list of values to compare against.

<img src="/files/EzvNnv4DKlnkJykqWy6Q" alt="" width="563">

{% hint style="info" %}

## **Usecase: Potential Savings > $500**

* **Criteria**: Potential Savings
* **Limit**: Greater Than
* **Borderline**: 500 (this would filter for tickets where potential savings are greater than $500).
  {% endhint %}

You can set multiple conditions, each with unique criteria, limits, and boundaries, depending on the ticket types you wish to target.

Once all conditions are defined, click **Save Changes** to finalize the trigger.
{% endstep %}

{% step %}

### Create the Jira Issue

After setting the trigger and conditions, click **Add Step**.

<img src="/files/WpJN7f4R0VHMYVQEZTyY" alt="" width="563">

Select **Jira** from the left menu and then choose **Create a Jira Issue**.

<img src="/files/BEnq2BrBYD8nR352Jrfv" alt="" width="563">

#### **Configuring the Jira Issue**

You will now need to add the following details:

* **Connection Type**: Choose the appropriate connection type for your Jira instance.
* **Project Name**: Select the project to which the issue will be assigned.
* **Epic**: Specify the epic under which the issue will be categorized.
* **Assignee**: Choose the team or individual who will be responsible for the issue.

<img src="/files/440yWpRpiiAEx3WPBUsU" alt="" width="563">

After entering the details, click **Save Changes**.
{% endstep %}

{% step %}

### Publish Workflow

Review the workflow representation to ensure everything is set up correctly.

Click **Publish** to make the workflow active.

<img src="/files/WFv7XJBAEVQT1WqX92Fk" alt="" width="563">
{% endstep %}
{% endstepper %}

## Result

Here is how your Jira issue will look like:

<figure><img src="/files/jS55PKry3YK5sAxNogEc" alt="" width="563"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onelens.cloud/automate/workflows-and-automation/usecases/automatically-create-jira-issues-for-new-tickets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
