Skip to main content
Skip table of contents

Set custom field value in Automation rule based on a Jira Text field

Objective

Learn how to set the value of a Elements Connected custom field in Automation for Jira rule, based on a Jira Text field.

Tutorial

Prerequisites

  • Elements Connect is installed on your Jira Cloud instance

  • A Jira Text field (Single line) has been created and added to the relevant project/screen (let’s say the project is PM).

  • The ID of the created Jira Text field has been identified (follow this KB to find your custom field ID). Let’s say the ID is “customfield_yyyyy”

  • A REST API datasource has been set up, connected to the local Jira instance (tutorial explained here), and successfully tested in Elements Connect.

Steps

We need to set the value of a Connected custom field, Issue picker, plugged to local Jira REST API.

Case 1 - Set Snapshot custom field

Custom field configuration

  • Create a Connect custom field, Select list single value.

    2024-12-24 13_50_01-Elements Connect - Configuration - Jira.png

  • In the “Customize look & feel” section, set the custom field type as Snapshot.

  • Set the template as below (the field will display and store the issue key).

    2024-12-23 16_10_25-Elements Connect - Configuration - Jira.png

  • Save your field configuration

  • Add the field to a project/screen (let’s say the project is PM)

  • From the Elements Connect administration page, note the Connect custom field ID (let’s say it's customfield_xxxxx)

    2024-12-23 16_21_38-Elements Connect - Configuration - Jira.png

Automation rule configuration

  • In Automation for Jira, create a rule as below:

    • Trigger: Manually triggered (or any trigger of your choice).

    • Action: Edit issue

      • Select “More options” and in “Additional fields” section, paste the below

        CODE
        {
           "fields":{
              "customfield_xxxxx":"{{issue.fields.customfield_yyyyy}}"
           }
        }
      • Replace customfield_xxxxx by the ID of your Connect field, customfield_yyyyy by the ID of your Jira Text field:

        image-20250103-133157.png
    • Set rule name and publish it.

  • Trigger the rule manually from the project where you’ve added the Jira text field and the Connect field (let’s say the project is PM) and the value of the Text field will be copied into the Connect field

It’s mandatory that the value in the Jira Text field matches the value defined in the field Template.

Case 2 - Set Object custom field

Custom field configuration

  • Create a Connect custom field, Select list single value.

    2024-12-24 13_49_00-Elements Connect - Configuration - Jira.png

  • In the “Customize look & feel” section, set the custom field type as Object.

  • Check the option Recalculate displayed value on issue view

  • In the Live path section, use the below (where customfield_xxxxx is the ID of the current Connect custom field)

    2024-12-24 13_58_53-Elements Connect - Configuration - Jira.png
  • In the Template section (this means that for this object, we will store the issue id in its ID attribute, and issue key will be stored in the template attribute)

    2024-12-24 14_00_59-Elements Connect - Configuration - Jira.png

  • Save your field configuration

  • Add the field to a project/screen (let’s say the project is PM)

Automation rule configuration

  • In Automation for Jira, create a rule as below:

    • Trigger: Manually triggered (or any trigger of your choice).

    • Action: Edit issue

      • Select “More options” and in “Additional fields” section, paste the below

        CODE
        {
           "fields":{
              "customfield_xxxxx":{
                 "id":"{{issue.fields.customfield_yyyyy}}",
                 "value":""
              }
           }
        }

        (info) Even if the value attribute is empty, it remains mandatory.

      • Replace customfield_xxxxx by the ID of your Connect field, customfield_yyyyy by the ID of your Jira Text field:

        image-20250103-133331.png
    • Set rule name and publish it.

  • Trigger the rule manually from the project where you’ve added the Jira text field and the Connect field (let’s say the project is PM) and the value of the Text field will be copied into the Connect field

It’s mandatory that the field is Live (the option “Recalculate displayed value on issue view” is checked) and that value in the Jira Text field matches the value defined in the Object ID attribute

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.