Automation to replace part of description with custom field value

Danielle Drapeau February 10, 2025

I'm looking to run automation to replace a portion of my description with a custom field value

What I'm after is something like this:

There are certain fields we want people to update under certain circumstances, but we don't want them required for other reasons. So I've decided to put a note in the description. The list says all the fields to update. When the field has a value in it, I want the message replaced with the field value:

So by default the description would be:

Due Date: Go to the due date field and set value

When field is set it:

Due Date: 2/6/25

The syntax is is:

{{issue.description.replace("date", issue.dueDate)}}

Automation is replacing "Go to the due date field and set value" with the field value

The error I'm getting back typically is something like this:

Unable to render smart values when executing this rule: Failed to get value for issue.description.replace("Go to the due date field and set value", issue.dueDate): {{issue.description.replace("Go to the due date field and set value", issue.dueDate)}}
I am new to Jira, so it's possible my syntax is wrong. Though I've tried a number of different ways. I've seen a few articles about this and it seems no one can get it to work.
I've also tried:
"issue.dueDate"
{{issue.dueDate}}
"{{issue.dueDate}}"

1 answer

1 vote
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 10, 2025

Hi Danielle - Welcome to the Atlassian Community!

The fastest thing to do right now would probably be to have a custom Paragraph (multi-line text) field with the generic description default value but with:

Due Date: {{issue.duedate.jiraDate}}

Then update your rule so that it triggers on field value changed: Due Date and add a condition for Due Date is not empty. 

Then at an action for Edit Issue and select the Description field. Copy the the field for the current issue from your custom field. 

I am sure you can probably do a substring and replace the text, but I don't have time to research all of that right now.  :-)

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 10, 2025

Hi @Danielle Drapeau -- Welcome to the Atlassian Community!

Adding to John's suggestions:

The replace() function takes two text strings as parameters, but you are passing the Due Date directly (which is a date / time represented as a number).  Please try updating that to use the format you want as a text string.  For example:

{{issue.description.replace("Go to the due date field and set value", issue.duedate.format("MM/dd/yyyy"))}}

 

Even this approach could be error-prone: someone could alter that template text in the Description field, leading to a mismatch.  Please consider what people may do entering the fields if you want the rule to handle the cases,  perhaps using the separate field John suggests.

 

Kind regards,
Bill

Danielle Drapeau February 10, 2025

Thank you for your suggestions. I will try that. 

Beyond the due date replace, I will be replacing with custom fields as well. I was unable to get those to work either. They are either single or multi select picklists.

My syntax was similar to above:

{{issue.description.replace("Go to the due date field and set value", issue.customfield-xyz-code)}}

Do I need to do something similar with the format here too?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 10, 2025

That depends upon the field type as replace() takes text.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events