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

String replace in fields for Jira Project Automation

Hello, I'm trying to automate the process of filling estimated hours in my project. What I am trying to do is to get the input from a field (text), for which at the moment I'm testing out using just the description field.

The idea is to be able to manipulate the string of the field to automatically add it to the Original Estimate field. I am trying at the moment (without success) using Project Automation, New Action > Edit Issue.


I have 2 scenarios for which I need help:

1. Let's say I have in description the following value: 100 hours

I want to use jira automation to get this value copied from the description field over to the Original Estimate one. When trying it directly, the word "hours" isn't recognised in the field, so it needs to be replaced to "h". 


2. Another example is when I have something different than hours in the description and I need to do some calculations with it. 

Let's say I'm translating and the scope is 10000 words, which take 500 words an hour, so when having in description "10000 words".

I need to be able to remove the word "words", divide the number by 500 and add "h" at the end and copy it to the Original Estimate field.


Hence I would like to know if there's a way to manipulate text strings using Json so I can just say. Where "hours" replace it with "h". 


Thanks in advance!


1 answer

1 accepted

1 vote
Answer accepted

This JSON works fro the 100hours (without space) situation.

Changing de regex could make it work for any other cases.


"fields": {
"description": "{{issue.summary.jsonEncode}}",
"timetracking": {
"originalEstimate": "{{issue.description.match("(?:.*)\s(\d+)hours")}}h"


Hello, thanks for your answer Fran. unfortunately I get an error when trying to run it. 


Description in the field:


In the automation rules it looks like:



The regex is prepared for finding the text after some other text, change it by deleting (?:.*)\s and It will find the 'xxxhours' at beginning of the line, if you add \s* it will find 'xxx hours' with or without space between the number and the word hours.

playing with the regex you can make this work fine.

I recomend you to try and to learn about regex

Like revyx likes this

Thanks Fran! I was able to make it work in all cases, thanks for the help and the recommendation on regex, will definitely have a look to learn more. 

Have a nice day!

Suggest an answer

Log in or Sign up to answer

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