---
title: "How to work with custom fields"
canonical: "https://support.appfire.com/space/PSJ/15481174/How%20to%20work%20with%20custom%20fields"
format: markdown
---
> Macro (aura-html)


> Macro (excerpt)
> 
> Custom fields require special handling to access and modify their values. Unlike standard fields, custom fields can be referenced by direct name, unique identifier, or by creating custom aliases.

---

## Getting field values

|  |  |
| --- | --- |
| #### Example 1a: Direct name reference<br>```
string color = Color;
``` | Retrieves a field value using its direct name. |
| #### Example 1b: By name with spaces<br>```
string color = #{Product Color};
``` | Accesses fields with spaces or complex names using the `#{}` syntax. |
| #### Example 2: Reference by a unique identifier<br>```
string color = customfield_12345;
``` | Retrieves a field using its unique system-generated identifier.<br>> ✅ Getting the value using the custom field ID is not the best practice when writing SIL scripts. Instead, use field names or aliases for better readability and script portability. |
| #### Example 3: Alias reference<br>```
string color = productColor;
``` | Uses an alternative name or alias for the field. |

---

## Setting field values

Field assignments provide multiple approaches to set values using different referencing techniques, each tailored to specific scenarios within a system.

|  |  |
| --- | --- |
| #### Example 1: Direct name assignment<br>```
Color = "Red";
``` | Sets a field value using its direct name. |
| #### Example 2: Assignment by a unique identifier<br>```
customfield_12345 = "Blue";
``` | Updates a field using its system-generated unique identifier. |
| #### Example 3: Alias assignment<br>```
productColor = "Green";
``` | Sets a field value using an alternative or alias name. |

> ℹ️ - For more information about accessing variables in custom fields, see [Variable types and reference methods](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15485601).
> ℹ️ - For more information about aliases, see [How to work with custom field aliases](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15486340).

---

## Working with specific custom field types

### Cascading fields

> ℹ️ Supported field types:
> ℹ️ 
> ℹ️ - Select List (cascading)

Cascading fields in Jira contain two related values: a parent (primary) value and a child (secondary) value that depends on the parent selection. When working with cascading fields in SIL scripts, you'll need to use string arrays to handle both values properly.

#### Getting field values

|  |  |
| --- | --- |
| ##### Example 1: Retrieving cascading field values<br>```
string[] myCascad = customfield_12345;
``` | Creates a string array variable to capture both the parent and child values from a cascading field. The first element (index 0) contains the parent value, while the second element (index 1) contains the child value. |

#### Setting field values

|  |  |
| --- | --- |
| ##### Example 1: Setting cascading field values<br>```
customfield_12345 = {"parent_value", "child_value"};
``` | Sets both values of a cascading field by providing an array where the first element represents the parent (primary) value and the second element represents the child (secondary) value. |

---

### Data fields

> ℹ️ Supported fields:
> ℹ️ 
> ℹ️ - Date Picker
> ℹ️ - Date Time Picker

Date fields in Jira store temporal information that can be manipulated within SIL scripts. When working with date custom fields, you'll need to use the date variable type to properly handle date values for accurate date operations and formatting.

#### Getting field values

|  |  |
| --- | --- |
| ##### Example 1: Retrieving date field values<br>```
date myDate = customfield_12345;
``` | Creates a date variable that captures the value from a date custom field, enabling date-specific operations and formatting. |

#### Setting field values

|  |  |
| --- | --- |
| ##### Example 1: Setting cascading field values<br>```
customfield_12345 = "2021-04-15";
``` | Sets the value of a date field by providing a date string in the ISO format (YYYY-MM-DD). You can also assign a date variable directly to the field. |

---

### Multi-value fields

> ℹ️ Supported fields:
> ℹ️ 
> ℹ️ - Checkboxes
> ℹ️ - Labels
> ℹ️ - Select List (multiple choices)

Multi-value fields in Jira allow users to select multiple options from a predefined list of values. When working with multi-select custom fields in SIL scripts, you'll need to use string arrays to properly handle the collection of selected values.

#### Getting field values

|  |  |
| --- | --- |
| ##### Example 1: Retrieving multi-value field selections<br>```
string[] mySelections = customfield_12345;
``` | Creates a string array variable that captures all selected values from a multi-value custom field. Each element in the array represents one selected option. |

#### Setting field values

|  |  |
| --- | --- |
| ##### Example 1: Setting cascading field values<br>```
customfield_12345 = {"Existing Option 1", "Existing Option 2"};
``` | Sets multiple values for a multi-select field by providing an array of option values. Each element in the array represents a value to be selected in the field. |

---

### Numbered fields

> ℹ️ Supported field types:
> ℹ️ 
> ℹ️ - Number field

Number fields in Jira store numeric values that can be used for calculations within SIL scripts. When working with number custom fields, you'll need to use the number variable type to properly handle numeric values for mathematical operations and comparisons.

#### Getting field values

|  |  |
| --- | --- |
| ##### Example 1: Retrieving number field values<br>```
number myNumber = customfield_12345;
``` | Creates a number variable that captures the value from a number custom field, enabling numerical operations and calculations. |

#### Setting field values

|  |  |
| --- | --- |
| ##### Example 1: Setting number field values<br>```
customfield_12345 = 2 + 2;
``` | Sets the value of a number field by providing a numerical value or expression. You can use direct values, variables, or expressions that evaluate to a number. |

---

### Text fields

> ℹ️ Supported field types:
> ℹ️ 
> ℹ️ - Radio Buttons
> ℹ️ - Select List (single choice)
> ℹ️ - Text Field (multi-line)
> ℹ️ - Text Field (single-line)
> ℹ️ - URL Field

Text fields in Jira store alphanumeric content that can be manipulated within SIL scripts. When working with text custom fields, you'll need to use the string variable type to properly handle text values for string operations and formatting.

#### Getting field values

|  |  |
| --- | --- |
| ##### Example 1: Retrieving text field values<br>```
string myText = customfield_12345;
``` | Creates a string variable that captures the value from a text custom field, enabling string operations and text manipulation. |

#### Setting field values

|  |  |
| --- | --- |
| ##### Example 1: Setting text field values<br>```
customfield_12345 = "Hello world!";
``` | Sets the value of a text field by providing a string literal or variable. You can use direct text values in quotes or string variables. |

---

### User fields

> ℹ️ Supported field types:
> ℹ️ 
> ℹ️ - User Picker (single user)

User fields in Jira store references to system users that can be retrieved and set within SIL scripts. When working with user custom fields, you'll need to use the string variable type to handle username values properly.

#### Getting field values

|  |  |
| --- | --- |
| ##### Example 1: Retrieving user field values<br>```
string myUser = customfield_12345;
``` | Creates a string variable that captures the username value from a user custom field. The returned value is the username of the selected user. |

#### Setting field values

|  |  |
| --- | --- |
| ##### Example 1: Setting user field values<br>```
customfield_12345 = "jsmith";
``` | Sets the value of a user field by providing a username string. You need to use the exact username of an existing user in the system. |

---