Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Script Runner Clone issue condition Groovy code not working

Edited
Deleted user May 07, 2020

Hi,

I need to use Adaptavist Script Runner function 'Clone issue' in a transition's post-function to create new issues when parent issue is set to a certain status and also has a condition met.

I have successfully created the new issue, but when adding the condition below, things stopped working. I have searched this forum as well as goggle, but cannot isolate what I am doing wrong.

Edit: Further testing gives that it probably is the returned datatype that I handle wrong. Every thing until the if-statement evaluates to true, thus generates the new issue. If included it evaluates to false, thus my assumption I read the returned data in a wrong way. I have also changed the code slightly;

I found an example where all selected checkbox values were added to a string, which I though might help, but did not.

This is the code I currently try to use;

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.fields.CustomField

CustomField customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(12448)

StringBuilder stringBuilder = new StringBuilder()
((List<Option>) issue.getCustomFieldValue(customField)).each {
stringBuilder.append(it.getValue()).append(", ")
}
def SelectedOptions = stringBuilder.toString()

if ("Option" in SelectedOptions) {
return true
}

Thanks

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

319 views 3 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you