Forums

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

I need to add a JIRA Cloud automation based on length of a custom short-test feild.

Michael Savedra March 23, 2022

What I'm trying to acheive is to trigger an action (comment) when a ticket is raised based on a condition that if the text length within a custom feild exceeds a certain length (21 characters). 

The conditions available to me do not seem to give me this option so I beleive I will need to use Scriptrunner? I'm just not sure how to integrate that with the JIRA Cloud automation conditions. 

Please help :)

 

Many thanks,

 

Mike

1 answer

1 accepted

3 votes
Answer accepted
Mark Segall
Community Champion
March 23, 2022

Hi @Michael Savedra and welcome to the community!

So if I understand correctly, you would want something like this...

2022-03-23_05-48-02.png

For copy/paste purposes, here's the smart value:

{{issue.customfield_xxxxx.length}}

Note - xxxxx = your custom field ID

Michael Savedra March 23, 2022

Hi Mark, Glad to be here!

 

That's super helpful I will give that a try. 

 

What I'd also be looking to do would be to add the total length of 2 custom fields and then if the sum is greater than 21, to then trigger the comment action. (First name and last name being separate custom fields).  I assume this would need to be done with Scriptrunner? 

 

Many thanks,

Michael

Mark Segall
Community Champion
March 23, 2022

That should be possible with native automation as well.  You could do something like this in your advanced compare condition:

{{issue.<customfield1>.concat({{issue.<customfield2>}}).length}}

Like Michael Savedra likes this
Michael Savedra March 23, 2022

Amazing thank you Mark! 

 

Seems I need to familiarise myself with the smart values a bit more. 

 

Much appriciated :) 

Mark Segall
Community Champion
March 23, 2022

Happy to help!  Yes - Smart Values are amazingly powerful.  Here is my favorite reference (note - this takes you to text fields, but the right navigation has a plethora of other docs on them):

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/

Michael Savedra March 23, 2022

Hi Mark,

The first example you shared works perfectly. When concatenating teh two fields though, the automation doesn't seem to recognise the Smart value i've put in. Am I formatting this correctly?:

 

"{{issue.customfield_21635.concat({{issue.customfield_21636}}).length}}"

 

Thanks in advance,

Mike

Michael Savedra March 23, 2022

Ignore me I figured it out (second set of curly braces not required)

 

Thanks again for your help! 

Suggest an answer

Log in or Sign up to answer