Forums

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

Combining smart value functions (i.e. substring and lastindexof)

Randy Knight May 6, 2022

Trying to put together a smart value to substring an issue description where I need to dynamically determine the position of the string.  Something like the following which does not work.  

{{issue.description.substring({{issue.description.lastIndexOf("/")-5}},4)}}

What am I missing here? 

2 answers

0 votes
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.
May 7, 2022

Hi @Randy Knight 

Although nested smart values for functions do not work yet, and created variables as function inputs do not work consistently, there may be another approach...

You appear to want some piece of the description, so perhaps using a regular expression with match() to extract text and the parsing further would work.

Would you please describe your Description field contents and the problem you are trying to solve?  That may give the community context to offer other ideas.  Thanks!

Kind regards,
Bill

Robert Yataco May 25, 2022

Hi @Bill Sheboy I am having the same problem, in my case I am sending emails to JIRA to open an issue and inside description's body I put some variables for example :

[AREA]HR[ENDAREA] -> to show the origin AREA where the issue come from, and in a SmartValue I want to extract with substring "HR" text to put it in a Custom Field in the issue but I get error instead.

This is my Smart Value:

{{issue.description.substring({{issue.description.indexOf("[AREA]")}})}}

(just in case this is an example)

How could I work this in order to fill a custom field of an issue received from email. Thank you in advance.

Regards,

 

Robert

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.
May 25, 2022

Hi @Robert Yataco 

Please take a look at the match() function with a regular expression to pull what you want: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match--

For example:

{{issue.description.match(".*[AREA](.*)[ENDAREA].*")}}

If this could return multiple results, you will need to parse the result as a list.

Kind regards,
Bill

0 votes
Tuncay Senturk
Community Champion
May 7, 2022

Hi @Randy Knight 

Unfortunately, nested smart value functions are not possible at the moment.

Have a look at this issue or this post.

Suggest an answer

Log in or Sign up to answer