Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Retroactively populating a Jira field with info in a form.

Nate Jenks
Contributor
August 3, 2023

I think I know the answer to this, but thought I would ask the community just in case.

 

I have a Service project that was taken over by a new user and that new user wants a report on the project that shows how many tickets were created over the last year by location. The thing is, the location field was part of a Jira form and not linked to a Jira field. This makes it so we can't make a series to report on that field. I made a custom field to link the form field to so that the new user can start gathering data. 

My question is, is there a way to retroactively fill in the new custom field on all the old tickets with the field it is linked to in the form? 

 

Thank you!

1 answer

0 votes
Ste Wright
Community Champion
August 4, 2023

Hi @Nate Jenks 

This is possible, although it's a workaround, and you do need a (free) App.

---

App - Entity Property Tool for Jira

App is here: https://marketplace.atlassian.com/apps/1214509/entity-property-tool-for-jira?hosting=cloud&tab=overview

You're going to use this App to find the relevant IDs needed below. You can choose to limit who can see this tool (yourself or everyone), and turn it off when not in use if preferred.

---

Automation Rule

The rule is just an example, see below on how it works using a single-line text field:

  • Trigger: Scheduled Issues
    • Run rule every = 1 Weeks
    • Run a JQL search and execute actions... = TRUE
    • JQL - locate relevant issues
    • Only include issues that have changed... = FALSE
  • Condition: 
    • First Value = {{issue.properties."proforma.forms.i1".state.answers.2}}
    • Condition = does not equal
    • Second Value = Empty - leave field empty
  • Action: Edit Issue
    • Field = Text Field
      • Value = {{issue.properties."proforma.forms.i1".state.answers.2.text}}

---

Form Field IDs 

This is how the form field smart value works:

  • {{issue.properties."proforma.forms.i1".state.answers. - this allows you to access form fields, based on their entity property IDs
  • The above is the ID - you can access that from the Entity Properties on an Issue once the App is installed...
    • Go to the bottom of an Issue, and select "Entity Properties" from the Activity section
    • Look in the proforma.forms.i1" section
    • Look for the question ID, eg.
      • "2": {
        "type": "ts",
        "label": "<name here>",
        "description": "",
  • The field type will then judge what you need to do next - and not every form field can be displayed as text (eg. select lists are only available as choice IDs). For example...
    • Text: You can access the text value by adding the smart value text denominator - eg. {issue.properties."proforma.forms.i1".state.answers.2.text}}
    • Select List: You can't access the label data here, so you'll need to use the IF Block Condition, and the Advanced Compare Condition, to populate a Jira field, such as...
      • Condition: IF Block...
        • IF...
          • Sub-Condition: Advanced Compare Condition
            • First Value = {{issue.properties."proforma.forms.i1".state.answers.3}}
            • Condition = contains
            • Second Value = choices=[1]
          • Sub-Action: Edit Issue
            • Field = Select List Field
              • Value = Yes
        • ELSE-IF...
          • Sub-Condition: Advanced Compare Condition
            • First Value = {{issue.properties."proforma.forms.i1".state.answers.3}}
            • Condition = contains
            • Second Value = choices=[2]
          • Sub-Action: Edit Issue
            • Field = Select List Field
              • Value = No
        • ...etc
    • You can get the choice ID from the Entity Properties also, but you'd need to check one Issue per select choice option, eg.
      • "choices": [
        {
        "id": "1",
        "label": "<choice wording here>",
        "other": false

---

Other Notes

  • Trigger: You don't need to run the rule on a schedule - this trigger lets you run the rule manually immediately. So you could run the rule, get the data moved to a Jira field, then disable it after.
  • Log Action: If you want to test the output of the smart value prior to using it on the Issue itself, use the Log Action action, to place the value in the Automation Rule's audit log. That way you can test the result without modifying Jira.
    • This is especially useful when testing the smart value outputs of different form field types
  • There is a suggestion to add this functionality, see JSDCLOUD-10697, but the last update in March 2023 suggests adding this feature isn't on the short-term roadmap. However, improving the REST API for forms is a WIP, see JSDCLOUD-10671  

---

Let us know if this works for you!

Ste

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events