Apps documentation
Extension for Jira Service Management
Cloud Server/Data Center
Extension for Jira Service Management

Cloud

Server/Data Center

Documentation
FAQ
Release notes
Articles & Videos
Last updated Jan 21, 2020

Bundled Fields (version 6.8.x and 6.9.x)

This section provides information on configuring Bundled Fields.

Note
If you use Extension v.6.7.x. or earlier, go to this page.

A Bundled Fields feature allows to bundle all information into one custom field. This custom field is displayed as additional form. This feature supports the following types of custom fields:

  • checkboxes,
  • text fields (single and multi-line),
  • select list (single choice),
  • date picker,
  • date time picker,
  • time picker,
  • and user picker (single user).
Note
  • Remember to add the field to the issue screen and to the request type.
  • To check your settings, go to: Project Settings > Request Types > Edit fields > Add a field.
Warning
Before you start, log in as a user with the Jira Administrators global permission.

Add Bundled Field

Info

For more information on adding a custom field, see official Atlassian documentation.

Steps

To add a bundled field:

  1. Go to Jira Administration > Issues.
  2. Select Custom Fields from the menu in the Fields section.
  3. Click Add custom field.
    The Select a Field Type dialog box appears.
  4. Select Deviniti [Extension] - Bundled Fields from the list in the Advanced section.
  5. Click Next.
    Configure Deviniti [Extension] - Bundled Field’ Field dialog box appears.
  6. Configure the selection criteria (Name and/or Description).
  7. Click Create.
  8. Select the checkboxes of the screens on which this custom field will be displayed.
  9. Click Update.

Result

Global permission. A new custom field Deviniti [Extension] - Bundled Fields is added.

Configure Bundled Field

Steps

To configure a Bundled Field custom field:

  1. Go to Jira Administration > Manage apps.

  2. Select Bundled Fields from the menu in the Extension for Jira Service Management section.

  3. Select a custom field with its context which you want to configure.
    The list contains all Deviniti [Extension] - Bundled Fields custom fields which are added to Jira.

  4. Layout on the Issue View screen: Select how to compose fields: Horizontal, Vertical or Custom.

    • Custom alignment supports settings from step 7.
      Creating a request with custom alignment in Bundled Fields with Extension for Jira Service Management
      Creating a request with custom alignment in Bundled Fields with Extension for Jira Service Management
    • For Horizontal and Custom alignment you can show label only for the first row (like a table heading). Show label only for the first row prevents from repeating field’s labels in case of creating many rows within the issue. If you mark this option as checked, newly created issue will be displayed as in example below:
      Example of request with horizontal alignment in Bundled Fields with Extension for Jira Service Management
      Example of request with horizontal alignment in Bundled Fields with Extension for Jira Service Management
      If you mark Show label only for the first row (in horizontal alignment) as unchecked, field’s labels will be repeated:
      Example of request with horizontal alignment in Bundled Fields with Extension for Jira Service Management
      Example of request with horizontal alignment in Bundled Fields with Extension for Jira Service Management
    • For Vertical alignment all bundled fields are displayed one by one.
      Example of request with vertical alignment in Bundled Fields with Extension for Jira Service Management
      Example of request with vertical alignment in Bundled Fields with Extension for Jira Service Management
  5. Click Add new sub-fields.

  6. Configure the following:
    a. Sub-field name: Type name of nested field.
    b. Type: Select type of sub-field: Checkboxes, Date Picker, Date Time Picker, Time Picker, Text Field (single line), Text Field (multi-line), Select List (single choice), User Picker (single user).

    Note

    For Checkboxes and Select List (single choice), new option can be added by clicking:

    • + new option under options: Type new option.
    • More > Bulk add options: Type in new options and separate them with Enter.
    Bundled Fields configuration
    Bundled Fields configuration
    • More > Import options: Define a source custom field (Checkboxes, Radio Buttons, Select List (single choice), Select List (multiple choices)) and the context.
    Bundled Fields configuration
    Bundled Fields configuration

    For Text Field (single line), you can define the formatting and validators. Read more here.


    c. Required: Set the state of switch to on to make sub-field required.
    d. Show label: Set the state of switch to on to show label of sub-field (Sub-field name).
    Tip
    • Click Copy to copy nested field with configuration and create new sub-fields quicker.
    • Use drag-and-drop to re-order nested fields in the list.

  7. In Layout settings section switch Turn on Edit mode to on.
    Now you can change field’s size and location.

    Note
    Fields options (Type, Copy, Delete, Add new sub-fields, Delete sub-fields) are disabled while editing Layout.

  8. Click Save Layout.

Bundled Fields configuration
Bundled Fields configuration

Result

Bundled Field has been configured.

Advanced Settings - Details

Steps

To configure Bundled Field’s details:

  1. Click Advanced Settings > Details.
    Bundled Fields configuration details
    Bundled Fields configuration details
  2. Configure the following:
    a. Description: Type text which will help user to fill fields.
    b. Default number of rows: Choose default number of bundled field rows. For example, if you select 3 rows, a bundled field will be displayed three times (in 3 rows).
    Note
    You can select max. 25 rows. If you select 0 as a Default number of rows, your Bundled field will generate as an empty state.
    c. Min. number of rows: The user will not be able to remove rows if they reach such number on the Create Issue and Edit Issue screens.
    Note
    If you select 0 as a Min. number of rows and user remove all rows on the Create Issue screen, all required sub-fields will convert into optional.
    d. Max. number of rows : The user will not be able to add rows if they reach such number on the Create Issue and Edit Issue screens.
  3. If your configuration is ready, click Save.
Bundled Fields configuration details
Bundled Fields configuration details

Result

Bundled Field’s details have been configured.

Advanced Settings - Import configuration

This option allows you to copy configuration from source custom field to the target field. Source custom field can be a Bundled Field from Dynamic Forms for Jira app and Extension for Jira Service Management app.

Steps

To import configuration:

  1. Click Advanced Settings > Details.
    Bundled Fields import
    Bundled Fields import
  2. Select a source custom field with its context.
  3. Click Import.
    Bundled Fields import
    Bundled Fields import
Warning
  • Imported configuration will replace configuration from current Bundled Field.
  • Values in the existing issues (which contain Bundle Field) will not replace but you won’t be able to change layout, format, or order option and rows.

Result

Bundled Field has a configuration from imported custom field.

Format and validation

You can define the formatting and validators for Text fields. By default, the None option is selected.

Steps

  1. Click More > Format and validation.

    Bundled Fields format and validation
    Bundled Fields format and validation

  2. Select option which you want to set.

    • Text Formatting

    Currency

    Number Format String
    1000.234 $0,0.00, $1,000.23
    1000.2, $0,0[.]00 $,1,000.20
    1001, $ 0,0[.]00, $ 1,001
    100.55 0.0 PLN, 100.6 PLN

    Percentages

    Number Format String
    1 0% 100%
    0.974878234 0.000% 97.488%
    -0.43 0 % -43 %
    1 0 1%
    0.64 0.00 0.64%

    Number

    Number Format String
    10000 0,0.0000 10,000.0000
    10000.23 0,0 10,000
    10000.1234 0.000 10000.123
    100.1234 00000 00100
    1000.1234 000000,0 001,000
    10 000.00 010.00
    10000.1234 0[.]00000 10000.12340
    -10000 (0,0.0000) (10,000.0000)

    To define formatting, you can also select locales from the list in the Advanced section. This list contains all languages supported by numeral.js. English (United States) [en] is set by default.

    Note

    If the value entered on the form does not match the format, the user will see a warning and the creation of the request will be blocked until he enters the correct value.

    <figure class="photoswipe-item">
        <a href="/server/extension/latest/1.bundled-fields/bundled_field_format_validation_1.1.png" data-size="6546x3462">
            <img src="/server/extension/latest/1.bundled-fields/bundled_field_format_validation_1.1.png" alt="Bundled Fields format and validation" title="Bundled Fields format and validation"/>
        </a>
        <figcaption style="display: none">Bundled Fields format and validation</figcaption>
    </figure>
    

    • Validation

    Select RegExp option if you want to use Regex. Regular Expressions aka Regex are expressions that define a search pattern. They are widely used for validation purposes, like email validation, url validation, phone number validation and so on.

    Commonly used regex

    1. Alphanumeric Characters

      • Alphanumeric without space: ^[a-zA-Z0-9]*$
      • Alphanumeric with space: ^[a-zA-Z0-9 ]*$
    2. Email

      • Common email Ids: ^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$
      • Uncommon email Ids: ^([a-z0-9_\.\+-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$
    3. Password Strength

      • Should have 1 lowercase letter, 1 uppercase letter, 1 number, and be at least 8 characters long (?=(.*[0-9]))((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.{8,}$
    4. URL

      • Include http(s) Protocol: https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*)
      • Protocol Optional: (https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)
    5. Phone Number

      • ^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$
    6. Credit Card Numbers

      • American Card: ^3[47][0-9]{13}$
      • Diners Club Card: ^3(?:0[0-5]|[68][0-9])[0-9]{11}$
      • JCB Card: ^(?:2131|1800|35\d{3})\d{11}$
      • KoreanLocalCard: ^9[0-9]{15}$
      • Maestro Card: ^(5018|5020|5038|6304|6759|6761|6763)[0-9]{8,15}$
      • Mastercard: ^5[1-5][0-9]{14}$
      • Union Pay Card: ^(62[0-9]{14,17})$
      • Visa Card: ^4[0-9]{12}(?:[0-9]{3})?$
      • Visa Master Card: ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14})$
    Tip
    • Use this page to build and test RegEx.
      • Read more about Credit Card Regex Patterns.
      • Put your example to Test input to check if it works correctly. The result will be shown in the last column.
    • Masking

    Select Mask option if you want to help the user to provide data in a specific format (such as credit card number, zip code, phone number). Default format characters are:

    • 9: 0-9
    • a: A-Z, a-z
    • *: A-Z, a-z, 0-9

    For example:

    • for zip code in the United States: 99999-9999
    • for phone number in Germany: +4\9 99 999 99
    Tip

    Put your example to Test input to check if it works correctly. The result will be shown in the last column.

  3. Click Save.

    Bundled Fields format and validation
    Bundled Fields format and validation

Result

A configuration for Text field is set.

Using Bundled Fields

Steps

To check how bundled fields work:

  1. Go to Customer Portal.
  2. Select request type which contains Bundled Field.
  3. Fill in the request details, including the custom field: Deviniti [Extension] - Bundled Field (for example: Tools for new team).
  4. Click Create.
    Creating a request with custom alignment in Bundled Fields with Extension for Jira Service Management
    Creating a request with custom alignment in Bundled Fields with Extension for Jira Service Management

Result

The request with Deviniti [Extension] - Bundled Field (for example: Tools for new team) is created.

Bundled Fields Searcher

Extension for Jira Service Management provides a dedicated searcher. It allows to search issues in Jira which contains a Bundled Fields custom field. There are two options: issue in bundledFieldsEx("", "") (two arguments) and issue in bundledFieldsEx("", "", "") (three arguments).

  • issue in bundledFieldsEx("", "")
Syntax with details Example
issue in bundledFieldsEx(“customfield_name”, “subfield_value”) issue in bundledFieldsEx(“Address”, “Poland”)
It returns all issues which contain Address custom field where one value is Poland.
issue in bundledFieldsEx(“Address”, “”) It returns all issues which contain Address custom field where min. one value is empty.
issue in bundledFieldsEx(“customfield_id”, “subfield_value”) issue in bundledFieldsEx(“customfield_10301”, “Poland”)
It returns all issues which contain custom field with ID = 10301 (in this case: Address) where one value is Poland.
issue in bundledFieldsEx(“customfield_10301”, “”)
It returns all issues which contain custom field with ID = 10301 (in this case: Address) where min. one value is empty.
issue in bundledFieldsEx(“id”, “subfield_value”) issue in bundledFieldsEx(“10301”, “Poland”)
It returns all issues which contain custom field with ID = 10301 (in this case: Address) where one value is Poland.
issue in bundledFieldsEx(“10301”, “”)
It returns all issues which contain custom field with ID = 10301 (in this case: Address) where min. one value is empty.
  • issue in bundledFieldsEx("", "", "")
Syntax with details Example
issue in bundledFieldsEx(“customfield_name”, “subfield_name”, “subfield_value”) issue in bundledFieldsEx(“Address”, “Country”, “Poland”)
It returns all issues which contain Address custom field with Country sub-field (which value is Poland).
issue in bundledFieldsEx(“customfield_id”, “subfield_name”, “subfield_value”) issue in bundledFieldsEx(“customfield_10301”, “Country”, “Poland”)
It returns all issues which contain custom field with ID = 10301 (in this case: Address) with Country sub-field (which value is Poland).
issue in bundledFieldsEx(“id”, “subfield_name”, “subfield_value”) issue in bundledFieldsEx(“10301”, “Country”, “Poland”)
It returns all issues which contain custom field with ID = 10301 (in this case: Address) with Country sub-field (which value is Poland).

You can also search using parameters.

Parameter Example
NOT_EMPTY (search by sub-fields which are not empty) issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Last name”, “NOT_EMPTY”)
IN (search by sub-fields which contain selected values) issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Select field”, “IN”, “One”, “Two”)
NOT_IN (search by sub-fields which don’t contain selected values) issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Select field”, “NOT_IN”, “One”, “Two”)

You can also search by Date and Date Time sub-fields. Use the following patterns:

  • yyyy-MM-dd hh:mm a
  • yyyy-MM-dd
  • hh:mm a
Operator Example
< issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Date”,"<",“2019-04-30”)
issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Date Time”,"<",“2019-04-30 10:01 am”)
issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Time”,"<",“08:15 am”)
> issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Date”,">",“2019-04-29”)
issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Date Time”,">",“2019-04-30 09:55 am”)
issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Time”,">",“08:15 am”)
BETWEEN issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Date”,“BETWEEN”,“2019-04-29”,“2019-04-31”)
issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Date Time”,“BETWEEN”,“2019-04-30 09:50 am”,“2019-04-30 10:10 am”)
issue in bundledFieldsEx(“Bundled Field 1 (DF)”, “Time”,“BETWEEN”,“08:13 am”,“08:15 am”)
Tip

To find an ID of Bundled Field custom field, go to the Issues > Custom Fields. Select custom field, click Edit and check URL address.
Example: http://192.168.0.84:8082/secure/admin/EditCustomField!default.jspa?id=10301

Note

If you don’t see issues that contain Bundled Field custom field, go to the Issues > Custom Fields. Select custom field, click Edit and check Search Template. Bundled Fields Searcher should be set.

Bundled Fields
Bundled Fields searcher

Use data from Bundled Fields in Script Runner

This page provides information on using saved data in the Script Runner app.

Note
If you use Extension v.6.7.x. or earlier, go to this page.

Extension for Jira Service Management app allows to use data from Bundled Fields in the Script Runner, or in the external app.

The following .JSON file shows sub-fields which are Text Fields with formatting.

{
    "baseGroupId": {
        "fields": [
            {
                "id": "498dd485-5c01-4c08-a96e-9835b0f9e557",
                "originId": "498dd485-5c01-4c08-a96e-9835b0f9e557",
                "name": "Currency",
                "type": "text",
                "required": false,
                "options": [],
                "showLabel": true,
                "format": "0,000",
                "formatType": "CURRENCY",
                "locale": "pl",
                "selectableType": false,
                "isValid": true,
                "valuePreview": "123",
                "value": "123",
                "validationMessage": "Provide a number. Field will be formatted by 0,000"
            },
            {
                "id": "89d54237-7d5a-49d0-beb5-14448a80ee3a",
                "originId": "89d54237-7d5a-49d0-beb5-14448a80ee3a",
                "name": "Percent",
                "type": "text",
                "required": false,
                "options": [],
                "showLabel": true,
                "format": "0.000",
                "formatType": "PERCENT",
                "selectableType": false,
                "isValid": true,
                "valuePreview": "23.000%",
                "value": "23",
                "validationMessage": "Provide a number. Field will be formatted by 0.000"
            },
            {
                "id": "13c3f2ff-e672-42bf-baf4-6e3d862144a2",
                "originId": "13c3f2ff-e672-42bf-baf4-6e3d862144a2",
                "name": "Number",
                "type": "text",
                "required": false,
                "options": [],
                "showLabel": true,
                "format": "0.000",
                "formatType": "NUMBER",
                "selectableType": false,
                "isValid": true,
                "valuePreview": "555.330",
                "value": "555.33",
                "validationMessage": "Provide a number. Field will be formatted by 0.000"
            },
            {
                "id": "1133b666-b824-4d92-94ea-3e2eb371a2c4",
                "originId": "1133b666-b824-4d92-94ea-3e2eb371a2c4",
                "name": "Mail regex",
                "type": "text",
                "required": false,
                "options": [],
                "showLabel": true,
                "format": "^[0-9a-zA-Z_.-]+@[0-9a-zA-Z.-]+\\.[a-zA-Z]{2,3}$",
                "formatType": "REGEXP",
                "selectableType": false,
                "isValid": true,
                "valuePreview": "asdf@gmail.com",
                "value": "asdf@gmail.com",
                "validationMessage": "Provide a value, which will match with regular expression ^[0-9a-zA-Z_.-]+@[0-9a-zA-Z.-]+\\.[a-zA-Z]{2,3}$"
            },
            {
                "id": "9f5696e9-8177-4871-9aad-f97511c1a2bd",
                "originId": "9f5696e9-8177-4871-9aad-f97511c1a2bd",
                "name": "Phone mask",
                "type": "text",
                "required": false,
                "options": [],
                "showLabel": true,
                "format": "(999) 999-9999",
                "formatType": "MASK",
                "selectableType": false,
                "isValid": true,
                "valuePreview": "(555) 533-4353",
                "value": "(555) 533-4353",
                "validationMessage": "Provide a value, that matches the mask (999) 999-9999"
            }
        ]
    }
}

The following .JSON file shows the rest types available in Bundled Fields (Text Field without formatting, Select, Date, User).

{
    "baseGroupId": {
        "fields": [
            {
                "id": "dec73b72-fc00-499e-8096-a15a07d3a73f",
                "originId": "dec73b72-fc00-499e-8096-a15a07d3a73f",
                "name": "Text",
                "type": "text",
                "required": false,
                "options": [],
                "showLabel": true,
                "selectableType": false,
                "isValid": true,
                "valuePreview": "Random text 2",
                "value": "Random text 2"
            },
            {
                "id": "be3bc369-7e4a-4c61-a2cd-b187c2b22e2f",
                "originId": "be3bc369-7e4a-4c61-a2cd-b187c2b22e2f",
                "name": "Select",
                "type": "select",
                "required": false,
                "options": [
                    {
                        "id": "31df54a1-902f-485b-ac76-13f14c26dc8e",
                        "name": "1",
                        "order": 0
                    },
                    {
                        "id": "7abfae20-720a-4f06-9e88-d30f31367ae0",
                        "name": "2",
                        "order": 1
                    }
                ],
                "showLabel": true,
                "selectableType": true,
                "isValid": true,
                "valuePreview": "7abfae20-720a-4f06-9e88-d30f31367ae0",
                "value": "7abfae20-720a-4f06-9e88-d30f31367ae0"
            },
            {
                "id": "d4067c44-63ce-4362-b486-8e90efffe035",
                "originId": "d4067c44-63ce-4362-b486-8e90efffe035",
                "name": "Date time",
                "type": "datetime",
                "required": false,
                "options": [],
                "showLabel": true,
                "selectableType": false,
                "isValid": true,
                "valuePreview": "2019-11-21T08:00:00.000Z",
                "value": "2019-11-21T08:00:00.000Z"
            },
            {
                "id": "113c288f-c269-4558-93c6-01ebc1fbfd64",
                "originId": "113c288f-c269-4558-93c6-01ebc1fbfd64",
                "name": "User",
                "type": "user",
                "required": false,
                "options": [],
                "showLabel": true,
                "selectableType": false,
                "isValid": true,
                "valuePreview": "abu tulk",
                "value": "abu tulk"
            }
        ]
    }
}
Warning
If you use version Dynamic Forms 4.4 and earlier, use the following .JSON file which contains all field types available in these versions.
{
    "baseGroupId": {
        "fields": [
            { 
                "id": "1a66be6f-b9a6-4bb0-9780-7113f53e4ce6", 
                "name": "text fields", 
                "type": "text", 
                "required": true, 
                "showLabel": true, 
                "options": [], 
                "value": "test" 
            },
            {
                "id": "df42c0c8-0f36-4a6f-b7c9-1030d12e8621",
                "name": "select field",
                "type": "select",
                "required": true,
                "showLabel": true,
                "options": [
                    { "id": "48c432d0-93f2-46c9-959a-b19d56715b8f", "name": "option 1" },
                    { "id": "c891fc2c-2827-437f-81d2-d47ea8da4d29", "name": "option 2" },
                    { "id": "eb9ca7fc-ede1-47c8-9a3c-63823e9e1194", "name": "option 3" }
                ],
                "value": "c891fc2c-2827-437f-81d2-d47ea8da4d29"
            },
            {
                "id": "8655d759-d16a-4d54-b414-bb9391b42c2e",
                "name": "checkbox",
                "type": "checkbox",
                "required": true,
                "showLabel": true,
                "options": [
                    { "id": "1ae64d17-815b-4667-b26d-b1855ead1673", "name": "check 1" },
                    { "id": "ff303f03-f7b7-44fc-81fd-d0329d7deaaa", "name": "check 2" },
                    { "id": "9b2d710d-0505-46b4-b35f-95c1b3d211a3", "name": "check 3" }
                ],
                "value": "1ae64d17-815b-4667-b26d-b1855ead1673,ff303f03-f7b7-44fc-81fd-d0329d7deaaa"
            },
            { 
                "id": "79f1c607-8afe-489a-81f4-a13cba9b499e", 
                "name": "multitext field", 
                "type": "textarea", 
                "required": true, 
                "showLabel": true, 
                "options": [], 
                "value": "test multitext" 
            },
            { 
                "id": "1e1a5b39-c0c8-4426-8b40-33a7a99dacfc", 
                "name": "date field", 
                "type": "date", 
                "required": true, 
                "showLabel": true, 
                "options": [], 
                "value": "2018-11-20" 
            }
        ],
    "id": "baseGroupId"
    }
}

Get Bundled Field’s value

Variable (String) Description Example
issueKey Key of issue where bundled field is placed WORK-27
bundledFieldId ID of source bundled field customfield_10300
fieldName Name of the field in column in bundled field select field
Integer row Number of row in bundled field 0
Note
Rows numbering starts from 0.

The following example shows how to get Bundled Field’s value.

import com.atlassian.jira.component.ComponentAccessor
import groovy.json.JsonSlurper
import org.apache.log4j.Logger
import org.apache.log4j.Level

def log = Logger.getLogger("com.onresolve.scriptrunner.runner.ScriptRunnerImpl")
log.setLevel(Level.DEBUG)

//key of issue, where the bundledfields value is
String issueKey = 'WORK-27'
//id of bundledfield where we are looking for value
String bundledFieldId= "customfield_10300" 
//field column in bundledfield
String fieldName = "select field"
//row in bundledfield
Integer row = 0 

def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfBundledFields = customFieldManager.getCustomFieldObject(bundledFieldId)
def issue = issueManager.getIssueObject(issueKey)

String cfValue = issue.getCustomFieldValue(cfBundledFields)
Object jsonValue = new JsonSlurper().parseText(cfValue)

////Retrieve a value of requested row and field name
List fields = getFieldsForRow(row,(Map) jsonValue)
Map field = getFieldByName(fieldName,fields)
def value = getFieldValue(field)
log.info("my subField ${fieldName} value is ${value}")
value

def String getFieldValue(Map field){
    def type = field.type
    if(type == 'select' || type == 'checkbox'){
        return getOptionValue(field)
    }
    return field.value
}

def String getOptionValue(Map field) {
    List<Map> allOptions = (List<Map>) field.options
    String val = field.value
    String[] selectedIds = val.split(',')
    List<Map> selectedOptions = allOptions.findAll { it.id in selectedIds }
    return selectedOptions.name.join(', ')
}

def Map getFieldByName(fieldName, List<Map> fields){
    return fields.find{it.name == fieldName}
}

def List getFieldsForRow(row,Map json){
    List fields = null
    int i=0
    json.each{k,v -> 
        if(i == row){
            fields = ((Map) v).get("fields")
        }
        i++
    }
    return fields
} 

Copy Bundled Field’s value

Variable (String) Description Example
issueFromKey Key of issue from which field’s value will be copied WORK-27
issueToKey Key of issue to which field’s value will be copied WORK-28
cfFromId ID of source custom field customfield_10300
cfToId ID of target custom field customfield_10403

The following example shows how to copy Bundled Field’s value to another field with the same configuration.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue

String issueFromKey = 'WORK-27'
String issueToKey = 'WORK-28'
String cfFromId = "customfield_10300" //bundledfield id copy from
String cfToId = "customfield_10403" //bundledfield id copy to(copy to field must have the same configuration)

def issueManager = ComponentAccessor.getIssueManager()
def issueFrom = issueManager.getIssueObject(issueFromKey)
def issueTo = issueManager.getIssueObject(issueToKey)

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfFrom = customFieldManager.getCustomFieldObject(cfFromId)
def cfTo = customFieldManager.getCustomFieldObject(cfToId)

def cfValueFrom = issueFrom.getCustomFieldValue(cfFrom)
def cfValueTo = issueTo.getCustomFieldValue(cfTo)

if (cfFrom && cfTo) {
    def changeHolder = new DefaultIssueChangeHolder()
    cfTo.updateValue(null, issueTo, new ModifiedValue(cfValueTo, cfValueFrom),changeHolder)
}

issueTo.getCustomFieldValue(cfTo) != null

Need help?

If you can’t find the answer you need in our documentation, raise a support request*.

  • Include as much information as possible to help our support team resolve your issue faster.

Additional reading