Smart Values to substring an issue Summary

Kyall Fordham-Weir May 22, 2019

We are creating an automation that allows issues to be flagged for re-occurrence. 

As a part of this, we want the Issue Summary to contain a String and a Date. 

We are cloning the new issue (created by the automation) from the original issues that is flagged as re-occurring. 

For the Cloned issue, we need to add a new date to the issue summary. 

As a example, The original issue may have the summary "TEST ISSUE - 21/05/2019"

We want the new issue (Cloned) to have the summary "TEST ISSUE - 28/05/2019"

We've been trying to clone the original issue and set the new issue summary as the 'TEST ISSUE' part without the date (adding the date is not an issue) 

With Smart Values, we should be able to take the left-hand-side of the string, with the character length being the full length of the string without the date 

We've come up with something like this but, it doesn't work : 

{{Issue.Summary.Left({{Issue.Summary.Length()-11}})}}

 

Has anyone had any luck doing something simmilar? 

 

2 answers

1 accepted

0 votes
Answer accepted
Kyall Fordham-Weir May 29, 2019

Managed to get this working after leaving it alone for a while : 

The following will remove the right side of a smart value (string) and append the date : 

{{issue.summary.substringBefore("-")}}-{{#now}}func=plusDays(5),format="MMM dd, yyyy"{{/}}

Ended up having to use 'substring' to split the Summary Value 

Graham Twine June 6, 2019

Hi @Kyall Fordham-Weir do you perhaps know what fields can I use a function in?

 I am trying to do something that should be quite trivial and turns out I have burned a day. The Nfeed documentation is not the best.

I have tried this in both the Columns field and the template field. I either get a JSON path error or nothing at all .

//Column
@.Name.replace(".txt","")
//or
{{Name.replace(".txt", "")}}
//or
{Name.replace(".txt", "")}
//Template
{Name}.replace(".txt", "")

 

 

Kyall Fordham-Weir January 9, 2020

Hi @Graham Twine

 

For the above example, I am using Code Buckets automation for JIRA and entering the data directly into the fields (rather than the advanced JSON editor). This enables the use of the 'Smart Values' within the Automation tool.

Code Bucket's Documentation covers the available functions : https://docs.automationforjira.com/using-issue-fields/use-smart-values.html

 

Not sure if this helps - or if you solved the issue in the 8 months I took to reply )

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.
May 23, 2019

Hey Kyall,

We use the JMWE add-on to do that in a post function. 

Suggest an answer

Log in or Sign up to answer