Forums

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

ScriptRunner post-function: Auto create Subtask, conditions help

Timothy Ryner
Contributor
June 24, 2019 edited

I am trying use Scriptrunner's "Create a sub-task" post-function to automatically create a subtask on a particular transition when number custom field (named "# Maps") has a value above 25.  We'd like to create a subtask for checking maps when the parent issue indicates there are a lot of maps.

I can't figure out the syntax for the post-function's condition.  Below is basically what I need, but of course, the ">=" isn't valid.  

cfValues['# Maps'] >= '25'

Jira Server v7.9.2
ScriptRunner v5.4.12

Any ideas?  Thanks in advance!

1 answer

1 accepted

0 votes
Answer accepted
Payne
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.
June 24, 2019 edited

Even though your custom field is numeric, perhaps the cfValues[] array treats all custom fields as strings. Try casting to an int, i.e.

(int)cfValues['# Maps'] >= 25

Timothy Ryner
Contributor
June 26, 2019

Gave it a quick test, and that appears to have done the trick!

Much obliged!

Like Payne likes this

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, rovo agent workshop, build a rovo agent, interactive workshop, Atlassian Intelligence, rovo agent building, automated triage, ai agents, cloud app development, atlassian learning, rovo studio, developer productivity, Rovo workshop

Let's build A Rovo Agent 🤖

Want to build your own Rovo Agent? Join this interactive workshop and dive into a powerful Rovo use case: improving resolution time with automated triage.

Save your spot
AUG Leaders

Atlassian Community Events