Forums

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

"Create a sub-task" post-function script is not behaving properly

Moon
Contributor
April 7, 2015

I am running JIRA version 6.3.12.

When a new issue gets created, I am trying to use two separate consecutive Post Functions in my workflow to automatically create subtasks if a condition is true and assign subtask to appropriate users. I am using script post-function to create these subtasks based on what Franchise Name was selected and assign the sub-task to different users. "Franchise Name" is a custom field that is a pull-down list. When an issue is created and the script runs, what I get is regardless of what Franchise Name is selected, always 2 subtasks get created. Any help will be really appreciated. 

-------------------------------------------------------------------

Here is what I have for the first post-function"

condition:

cfValues['Franchise Name']?.value == 'FRANCHISE A' || 'FRANCHISE B' || 'FRANCHISE C'

target issue type:

Sub-task

Additional issue actions: 

issue.summary = ('Franchise was selected:  ' + issue.summary)
issue.assigneeId = 'usernameA@email.com'

-------------------------------------------------------------------

Here is what I have for the second post-function

condition:

cfValues['Franchise Name']?.value == 'FRANCHISE AA' || 'FRANCHISE BB' || 'FRANCHISE CC'

target issue type:

Sub-task

Additional issue actions: 

issue.summary = ('Franchise was selected:  ' + issue.summary)
issue.assigneeId = 'usernameB@email.com'

----------------------------------------------------------------------

2 answers

0 votes
Moon
Contributor
April 8, 2015

Thank you for your response. The custom field is a "Select List (single choice)". I was playing around with it more and got it working using this condition statement:

(cfValues['Franchise Name']?.value == 'FRANCHISE AA') || (cfValues['Franchise Name']?.value == 'FRANCHISE BB') || (cfValues['Franchise Name']?.value == 'FRANCHISE CC')



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.
April 8, 2015

Excellent ! Good job ! fyi i added the tag "script runner" to your issue.

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.
April 8, 2015

First thing is your conditions: What type of custom field is your 'Franchise Name' ?

(if your custom field is a multi-select field it shoul be as follow : 

cfValues["Some Multiselect"]*.value.contains("Some value")

 

for the rest, the format should be as follow: 

issue.summary = 'Franchise was selected:  ' + issue.summary()
issue.assigneeId = 'username'

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery, jpd premium, product management, idea management, product discovery, jira premium, product planning, atlassian community, product development, roadmap planning, product prioritization, feature management

Introducing Jira Product Discovery Premium ✨

Jira Product Discovery Premium is now available! Get more visibility, control, and support to build products at scale.

Learn more
AUG Leaders

Atlassian Community Events