Currently using JIRA CLOUD
I am building a new hire form. Once the form is created and a user clicks "Start Progress" I have it so the issue will automatically create a single subtask and assign it to a user.
Note: The New Hire form has about 25-30 subtasks that our team will work on simultaneously from ICT to HR and Finance.
I am new to scriptrunner and groovy and would love a tutorial or guide on where I can find the fields/code needed to make this script work.
Hi Jesse,
You have two options here:
You can create multiple 'Create Subtask' Workflow Post Functions (see http://scriptrunner-docs.connect.adaptavist.com/jiracloud/post-functions.html#_create_subtask) for the 'Start Progress' transition, and also add a Post Function for sending a notification (see http://scriptrunner-docs.connect.adaptavist.com/jiracloud/post-functions.html#_send_notification)
When you are configuring the 'Create Subtask' post function there is an example code snippet you can use to set the assignee, and its simple to set the description using the following code:
subtask.fields.description = "Some description"
For the notification, you can write a code condition that checks the value of a specific custom field:
def customFieldValue = issue.fields['customfield_10234'] // We need to return true or false here in the condition code return customFieldValue == 'Sales'
I hope that helps,
Jon
Hello Jon,
Thanks for the prompt answer I appreciate it. For option 1 I know thats possible but due to the fact that we may have 15-30 subtasks I think the manual creation is too tedious and takes too long to edit and modify. I am new to coding but I saw it was possible to setup intellij ide and connect it to JIRA so I can learn the sample groovy code? Can you point me in the right direction for that setup I tried yesterday for 30 minutes but had no clue what I was doing. For option 2 how can I learn to write the code for this, I just need some reference guides and samples!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jesse,
I am looking for the same information right now. Did you ever find a good way of creating multiple sub-tasks from a single post function script?
I believe when Jon says to create a listener, he is referring to creating a global listener in the add-ons section under Scriptrunner. However, I am not well versed in Groovy and the script to actually fire the "create sub-task" event would probably take me longer to figure out than to just add 15 individual post function scripts.
Anyway, if you have any lessons learned you would like to share, I would love to hear it.
Thanks,
Jason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jesse Hernandez I know you are specifically referring to Scriptrunner here, but have you considered creating an automation rule using Jira Cloud's native tool called Automation for Jira? It is much less complex than a script being built in Scriptunner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.