Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Parse table in Description column using Jira automation

Using values in table columns in the description section, i want to create sub-task and populate issue summary and description. is this possible?

||Summary||Description||

|Summary of 1st sub-task|Description|

|Summary of 2nd sub-task|Description|

 

2 answers

1 accepted

0 votes
Answer accepted

Hello @Vishal Biyani ,

To do this you will need to set up a few layers of logic so that the data can be formatted and then iterated using Smart values and JQL for references in if-then statements in combination with Branch rules and multiple rules to do a looping condition to update all subtasks at the same time.  This one gets a bit complicated so I detailed out a full example (all be it a very simplified version) for you but first I recommend checking out these documents for a reference point to the functionality used below:

Depending on what outcome you need in the final form you will want to tweak this a bit possibly using additional custom fields as your staging fields but in this example, I set up all the data conversions and iterations in the description field directly and only added a single custom field to act as a counter of the number of subtasks for some logic.

First, I created a Custom field called counter that is a number field and added it to the project, this field will be used by the story to get the initial formatting in place on the parent issue so that the following subtask creation can be iterated on the initial formatting.  In my example the COUNTER field is customfield_10286, but this will be unique for your scenario

In the automation rules I set it up as follows (NOTING in the screenshots below I had the summary and description smart values swapped but in the written-out example, they have been corrected):

  • When: Issue Created
  • If: Matches
    • issuetype = story
    • THEN: Edit Issue Fields
      •  Description:
        • || Position | Summary | Description ||
          | Parent issue {{issue.key}} | {{issue.summary}} | {{issue.description}} |
      • COUNTER
        • 1
  • Else-if: Matches
    •  issuetype = Sub-Task
    • BRANCH RULE: For Current Issue
      • THEN: Edit Issue fields:
        • COUNTER
          • Copy COUNTER From Parent
      • AND: Re-Fetch issue data
      • AND: Edit issue Fields:
        •  Description
          • {{issue.parent.description}}
            | Sub-Task {{issue.customfield_10286}} {{issue.key}} | {{issue.summary}} | {{issue.description}} |
    • BRANCH RULE: For Parent Issue
      • THEN: Edit Issue fields:
        • COUNTER
          • {{issue.customfield_10286}} + 1
  • THEN: Re-fetch issue Data
  • BRANCH RULE, For Parent Issue
    • THEN: Edit issue Field
      • Description
        • COPY Description From Trigger Issue

This will take the initial Summary and description in a story and use the smart values {{issue.description}} and {{issue.summary}}   and convert the data into the table structure with the headers || Position | Summary | Description || like this 

Screen Shot 2020-09-09 at 1.20.00 PM.png

Then any time a new subtask is created it ad the count value for the subtask position (this could also use just the issue key using a smart value {{issue.key}} where I am only adding it for a reference point to position added in relation to the COUNTER field)) and it will copy the parent issues description to the subtask and append on an iteration the sub-tasks summary and description to the existing table data from the parent issues description via the smart value {{issue.parent.description}}  so each new Subtask will update the parent with all data and then append new data to the new subtask. like this Parent and subtask view:

Screen Shot 2020-09-09 at 1.24.33 PM.pngScreen Shot 2020-09-09 at 1.24.43 PM.png

Then we would hit a logic issue at this section for additional sub-tasks being added if we only have a single rule as there is no way to connect sub-task 1 to sub-task 2 without a secondary rule to fill the logic so we need to create a second Automation rule to update all existing subtasks with the updated Parent issue data when the new subtask updates in rule 1 so all subtask issues contain the same table data as the other subtask issues.

The Second Automation:

  • WHEN: Issue Updated
    • No Configuration needed
  • If: Issue Matches JQL
    • issuetype = story AND COUNTER >=2
  • BRANCH RULE: For Sub-Task
    • Then: Edit Issue fields
      • Description
        • Copy Description From Parent Issue

Make sure that in the Rule details you select "Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule."  for the "Allow Rule Trigger" section

This will then Cascade the changes of the most recently created subtask down to the previously created sub-task issues and in the screenshots below you can see Parent Sub-task 1 and sub-task 2:

Screen Shot 2020-09-09 at 1.28.53 PM.pngScreen Shot 2020-09-09 at 1.29.03 PM.pngScreen Shot 2020-09-09 at 1.29.11 PM.png

Again you can get pretty elaborate with this and use a staging text field as well if you wanted to avoid using the parent description to show the details as well and only have the subtasks showing other subtasks

Hope this helps get you on the right track.

Regards,
Earl

@Earl McCutcheon 

WOW!!! This is really detailed explained.

Thank You. This is really helpful

Regards,

Vishal

Like Earl McCutcheon likes this

In case you just want a different way, I did this: 

you can use lookupissues to generate a list with the values you mentioned, and store it in a variable or simply call them from the smart values using {{lookupIssues}}  as per https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Lookupissues

 

So in my example, I updated the Description using a "list" field, where a table was created with as many rows as items in the list where the first column contains the values: 

So I read the issue, and then update description with the following: 

 {{issue.Description}}

||*Header1*||*Header2*||*Header3*||
{{#<YOURFIELDHERE>}}
|{{.}}| col2 | col3 |
{{/}}

and the output is :

||*Header1*||*Header2*||*Header3*||
|list item1 | col2 | col3 |

|list item2 | col2 | col3 |

...

|list itemX | col2 | col3 |

I hope it makes sense, as I think it's a different way which doesn't require a field called "Counter" which wasn't doable for my project. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

196 views 6 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you