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'
----------------------------------------------------------------------
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')
Excellent ! Good job ! fyi i added the tag "script runner" to your issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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'
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.