Trying to automatize a workflow

Philippe Aubin
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 21, 2014

Can a task or subtask creation on transition be triggered only when one or more field are filed ?

Ex. 1 task tansition from status A to status B, 3 subtask are created, subtask 1 is created only if field X is not empty, subtask 2 is created only if if field Y is not empty, subtask 3 is created only if field Z in not empty.

3 answers

1 accepted

0 votes
Answer accepted
BenjiI
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 21, 2014

Hi Philip,

The idea is the following:

You have to create a workflow post-function for each sub-task that has to be created. Personally I prefer to use the script runner plugin to do it:

1) Install the script runner plugin

2) For every subtask that has to be created:

a) Add a Script Post-Function to the transition and select the Create a sub-task script

b) In the condiction field you can write a condition that decides if the script will be executed and this can by anything in fact. You can write a script that checks some custom fields and returns true/false based on those values.

c) Select the sub-task type

d) Add a sub-task summary

e) Specify additional sub-task actions (if needed). In this field you can also enter new Groovy scripting, for example to add values to other issue field

f) Optionally enter a sub-task action

Hope this helps?!

BenjiI
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 21, 2014

More info on getting custom field values in Groovy can be found here (script in the last comments):

https://answers.atlassian.com/questions/296363/set-custom-field-select-list-value

This thread gives you more info on how to read-out standard fields from the issue:

https://answers.atlassian.com/questions/297632/jira-workflow-post-function-executing-external-script

And also the API doc is very usefull:

https://docs.atlassian.com/jira/6.2.1/com/atlassian/jira/issue/Issue.html

0 votes
Philippe Aubin
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 15, 2014

After researching the plugin i have succed. One point is to be noted, the values of a custom field can't have more than 1 space. (ex. cfValues['Domain name selection'] is not working but cfValues['Domain_name_selection'] worked, so i had to change all my custom field name)

Thanks

0 votes
Philippe Aubin
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 22, 2014

So if i follow the logic;

cfValues['Domain name selection'] == -blank-
#should make that the subtask will only be created if the feild in not empty since Blank will evaluate to "true".





					
				
			
			
			
				
			
			
			
			
			
			
		

Suggest an answer

Log in or Sign up to answer