# Setting field values

The **Set field values** action sets the value for a specified field. For all actions, you have to select an "*Issue Field*", a "*Set value mode*" (append or overwrite), and a "*Content*". Once the content is selected, further content-specific configuration can be done.&#x20;

## The supported Jira system fields

<table><thead><tr><th width="147.33333333333331">Field name</th><th width="237">Manual / Default value</th><th>Value expression options</th></tr></thead><tbody><tr><td>Summary</td><td>Simple text</td><td></td></tr><tr><td>Description</td><td>Simple text</td><td></td></tr><tr><td>Priority</td><td>Case insensitive priority value</td><td></td></tr><tr><td>Reporter</td><td>Email address</td><td></td></tr><tr><td>Assignee</td><td>Email address</td><td></td></tr><tr><td>Due date</td><td>Format: yyyy-MM-dd<br>Example: 2023-10-11</td><td>$parser.parseDate("dd/MM/yyyy", $!group1)<br>For more details, click <a href="#value-expression">here</a>.</td></tr><tr><td>Labels</td><td>Case sensitive label value</td><td></td></tr></tbody></table>

## The supported custom fields

<table><thead><tr><th width="189.33333333333331">Field  type</th><th width="317">Manual / Default value</th><th>Value expression options</th></tr></thead><tbody><tr><td>Text based custom fields</td><td>Simple text</td><td></td></tr><tr><td>Checkboxes</td><td>Case insensitive value of the check box</td><td></td></tr><tr><td>Date Picker</td><td>Format: yyyy-MM-dd<br>Example: 2023-10-11<br>We support <a href="#zoned-datetime-handling">Zoned Date-Time</a>.</td><td>$parser.parseDate("dd/MM/yyyy", $!group1)<br>For more details, click <a href="#value-expression">here</a>.</td></tr><tr><td>Date Time Picker</td><td>Format: yyyy-MM-dd HH:mm:ss<br>Example: 2023-10-11 11:50:00+0000<br>We support <a href="#zoned-datetime-handling">Zoned Date-Time</a>.</td><td>$parser.parseDate("yyyy/MM/dd HH:mm:ss", $!group1)<br>For more details, click <a href="#value-expression">here</a>.</td></tr><tr><td>Radio Buttons</td><td>Case insensitive value of the radio button</td><td></td></tr><tr><td>Select List<br>(Cascading)</td><td>Case insensitive value of the cascade list<br>Format: [&#x3C;value1>, &#x3C;value2>]<br>Example: [parentValue, childValue]</td><td>$parser.cascade($!group1, $!group2)</td></tr><tr><td>Select List<br>(Multiple choice)</td><td>Case insensitive value of the multi select list</td><td></td></tr><tr><td>Select List<br>(Single choice)</td><td>Case insensitive value of the select list</td><td></td></tr><tr><td><p>User Picker</p><p>(Multi user)</p></td><td>Email address</td><td></td></tr><tr><td>User Picker<br>(Single user)</td><td>Email address</td><td></td></tr><tr><td>Assets Object</td><td>AQL query. Value resolves to the asset object(s) returned by the query.</td><td></td></tr></tbody></table>

In case of Single select and Radio button fields the selection is based on the value (coming either from the email with regexp or provided as manual value) in a case-insensitive way.

The currently supported sources are the following:

## Fields on the "Set field" form

### Issue Field

Select the field that needs to be set.

### Set value mode

Choose the handling of the original value of the field.\
There are two selectable types here:

* **Append to existing value** -> Extends the current value of the field
* **Overwrite current value** -> Current value will be deleted,  new value to be set

### Content

Select the source of the field value.

#### **Participants' email addresses**&#x20;

Only visible in case of user-, or text-based field types. Select which participants should be added as value.

#### **Participants' name**&#x20;

Only visible in case of user-, or text-based field types. Select which participants should be added as value. If the participants don't have a name, their email addresses will be used instead.

#### **Extract from email**

This option allows the user to extract the field's value from the email.

* **Email part:** The source email part:
  * Body
  * Subject
  * Header
* **Regexp:** Add a [regular expression](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html) to find the desired source text in the email.
* **Group:** The "old style" method to select the regular expression's result. Add a number, which represents the group of the regular expression's result. If you would like to test the regexp, you may find several testing tools on the internet upon the search term  "*java regular expression tester*".
* **Value Expression:** The "new style" method to select the regular expression's result. For more details, please check the "Value expressions" section.
* **Default value:** If the regexp result is invalid or empty, then this value will be added.

#### **Manual value**

A constant value may be added for the selected field.

* **Value:** The constant value that needs to be set. It is also possible to empty a field upon updating an issue. Leaving the Value field empty in an Update issue - Set field action will result in deleting the field's original content.

### Value expression

This expression helps the user to add values dynamically to the field. This is a velocity-supported field, so velocity logic can be added here.\
Email This Issue supports groups of regular expression like in the "old style" Group field.\
\&#xNAN;**$matchedText**  is a part of the input text, on which the regex matches.\
\&#xNAN;**$!group0**  represents the whole input text.\
\&#xNAN;**$!group\<n>**  is the n. group of the regular expression ($!group1 -> first, $!group2 -> second, etc...)

<details>

<summary>Use case</summary>

The admin wants to set the priority by the email's priority. In this example, the priority is stored in the "X-Priority" header as a simple number. "1" represents the Highest, and "5" represents the Lowest priority level.

The velocity code looks like this:

```
#if($!group0 == "1")
    Highest
#elseif($!group0 == "2")
    High
#elseif($!group0 == "3")
    Medium
#elseif($!group0 == "4")
    Low
#elseif($!group0 == "5")
    Lowest
#end
```

The form should be filled out the following way:

```
Issue field: Priority
Set value mode: Overwrite current value
Content: Extract from email
Email part: Header
Header name: X-Priority
Regexp: .*
Value Expression: #if($!group0 == "1")Highest#elseif($!group0 == "2")High#elseif($!group0 == "3")Medium#elseif($!group0 == "4")Low#elseif($!group0 == "5")Lowest
```

![](https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FHFWGwQ4ijWxpRpLtK5KS%2Fimage.png?alt=media\&token=f96fc51c-fce7-4118-9a5a-a6fb187a7b8b)

#### <mark style="color:orange;">Important:</mark>

The above example won't apply to every email client, as all email clients handle priority differently. Please always check your incoming email's headers to find out the best solution for your needs.

</details>

### Parsers

#### Parser for cascade fields

**$parser.cascade(\<VALUE1>, \<VALUE2>)**&#x20;

This parser helps the user to handle cascade custom field values. Here is an example of how to use it:

<details>

<summary>Use case</summary>

Have a cascade field that can take parentValue, childValue as parent and child values.

* Input: `MyCascadeValue: parentValue, childValue`
* Regexp: `MyCascadeValue:\s*(.*),\`*`s*`*`(.*)`
* Value expression: `$parser.cascade($!group1, $!group2)`&#x20;

The cascade field will be set to parentValue, childValue.

</details>

**Parser for date/time fields**

**$parser.parseDate(\<DATE\_TIME\_FORMAT>, \<VALUE>)**&#x20;

This parser helps the user to handle date-type fields.\
\<DATE\_TIME\_FORMAT> -> Here you need to add the [format](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html) of the input date-time.\
\<VALUE> -> The source of the date-time<br>

<details>

<summary>Use cases</summary>

The "Regexp" field's value is ***Value:\s\*(.\*)*** in all cases

1. A single date in the email:
   * Input: `Value: 24/12/2023`
   * Parser: `$parser.parseDate("dd/MM/yyyy", $!group1)`
2. Date and time in the email:
   * Input: `Value: 24/12/2023 11:30`
   * Parser: `$parser.parseDate("dd/MM/yyyy HH:mm", $!group1)`
3. A date and a time and timezone in the email:
   * Input: `Value: 24/12/2023 11:30:00+0000`
   * Parser: `$parser.parseDate("dd/MM/yyyy HH:mm:ssZ", $!group1)`

</details>

### Zoned DateTime handling

Email This Issue supports Zoned Date-Time for field setting. There are two ways to add the date-time:

1. The input does not have zone data (ex.: 2025-02-02 10:30:00): In this case, the app uses the sender user's timezone to add the date/time to the field.
2. The input has zone data (ex.: 2025-02-02 10:30:00+0000): In this case, the app uses the given zone to set the field's value.

This is required because these date-time fields are prepared for international usage (have time-zone property).<br>

To make sure the exact desired time will be saved to the field, it is necessary to add zone-offset data to the time (see example 2 above).<br>

{% hint style="warning" %}
**Important**: If you are using **Set field values** with **Create issue** and you are creating a request, you have to add the field to the **Request Type** and make it visible on the portal. Remember that you cannot add an **Assignee** to the portal, and cannot set it during request creation. As a workaround, create the request, set the fields, and in the next action, update the **Assignee** field.
{% endhint %}

{% hint style="info" %}
**Note**: If you want to add the sender as a request participant to the request, use the **Add sender to Request Participants** action.
{% endhint %}
