Forums

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

Problems With Smart Value

Marcelo Ignacio Cid Abud
Contributor
September 12, 2024 edited

 

Hello, I am using the following smart value to capture the word that comes after Fiscalizador: {{issue.description.match("Fiscalizador: (.+)")}}, the funny thing is that if I "paste" that smart value in a Text Field (single line) Jira interprets it as a kind of color (Clarify that Fiscalizador: will always have a number after it, ex: Fiscalizador: 12389). And if I paste this in the comments it simply pastes the number of this value. In summary If we take as an example the case of Fiscalizador: 1234 In a Text Field (single line) format field it will tell me 1234{color} In the comments it will show me 1234 I need to know if I am doing something wrong or if it is something specific to Jira. My intention is that only 1234 appears (it only happens to me with numbersCaptura2.PNG Captura3.PNG Captura1.PNG

1 answer

1 accepted

3 votes
Answer accepted
Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 12, 2024

Hi @Marcelo Ignacio Cid Abud 

Assuming the text you need is in a custom field called Description, and you want to capture what follows "Fiscalizador:":

{{issue.Description.split("Fiscalizador:").last.split(" ")[0]}}

This splits the description text by "Fiscalizador:", then takes the last part of that split result and further splits it by spaces, capturing the first word.

 

If you want to see the result for testing, you can use the "Log action" to output the captured value.
The captured value is: {{issue.Description.split("Fiscalizador:").last.split(" ")[0]}}

Or you might use this value to populate another field or take some other action in your rule.

Marcelo Ignacio Cid Abud
Contributor
September 12, 2024

@Manoj Gangwar Hi, thanks for the quick response. I'm going to try what you're telling me, but I'll leave you the images associated with my problem anyway hahaha

Marcelo Ignacio Cid Abud
Contributor
September 12, 2024
I have this error
Error rendering smart-values when executing this rule:
Failed to get value for issue.Description.split("Fiscalizador:").last.split(" ")[0]: {{issue.Description.split("Fiscalizador:").last.split(" ")[0]}}
Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 12, 2024 edited

Could you please test the smart values?

{{issue.description.match("Fiscalizador: (\\d+)")}}

OR

{{issue.description.match("Fiscalizador: (\\d+)")[0]}}

 

 

this one cleans up any special characters or formatting tags before inserting the value.

{{issue.description.match("Fiscalizador: (\\d+)")[0].replace("{color}", "")}}

 

Marcelo Ignacio Cid Abud
Contributor
September 12, 2024

Nice, the first option {{issue.description.match("Fiscalizador: (\\d+)")}} is good :D

Like Manoj Gangwar likes this
Marcelo Ignacio Cid Abud
Contributor
September 12, 2024

@Manoj Gangwar One last question, what happens in the case of words? How does the formula vary? I was looking and if I extract a phrase I still get the phrase {color}

Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 12, 2024

If you want to extract words or phrases after "Fiscalizador:", you can adjust the regular expression to allow letters, spaces, and possibly other characters. 

{{issue.description.match("Fiscalizador: ([\\w\\s]+)")}}

 

\\w matches any word character (letters, digits, and underscores).

\\s matches spaces (to handle multiple words).

The + ensures it matches one or more of these characters.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events