I have a need to create issues related to the current issue based on the number of items selected in a multiselect field (if 3 options are selected, 3 issues [with the summary being the name of the options] must be created) and related to the current issue.
I thought about using the "Clones an issue, and links" of Script Runner, but from what I understood, it would only issue one issue (it does not take into account the quantity of item selected).
I also thought about using the "Create issues and subtasks" of JWT, it has the option to create based on a stringlist, but I came across another problem, the value stored in the multiselector field is not a list .. in fact it's a single string separated by ###.
example: apple###orange###banana
(not counting that I still do not know how to put the value of selections as a summary).
Anyone have any suggestions?
Hi @Dante Labate,
you can still use JWT. Just use an expression like this (where nnnnn has to be replaced by the field code you're referring to):
toStringList(%{nnnnn},"###")
It'll return a list of elements representing the strings between your hashes.
Afterwards, you're able to reference the single values by just adding:
^%
Given your example - apple###orange###banana - you'll receive three issues with the summaries
Cheers,
Thorsten
@Thorsten Letschert _Decadis AG_
Creation worked (it creates the issue quantity according to the selection made).
my selection field has the id 17203
toStringList(%{17203},"###")
but I did not understand how to make the summary the value of each selection.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dante Labate,
like shown here (https://apps.decadis.net/display/JWT/Create+a+story+for+each+component+in+an+epic), you should use the placeholder ^%.
You can use it in every field, not just the summary. In the example mentioned above it's used for the summary as well as the description.
Cheers,
Thorsten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
You need to write a custom script and add it to your workflow as a postfunction. A script like this would work:
import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.bc.issue.IssueService.CreateValidationResult;
import com.atlassian.jira.bc.issue.IssueService.IssueResult;
import com.atlassian.jira.issue.IssueInputParameters;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.issuetype.IssueType;
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.link.IssueLinkTypeManager
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def issueManager = ComponentAccessor.getIssueManager()
def authenticationContext = ComponentAccessor.getJiraAuthenticationContext()
def issue = issueManager.getIssueObject("SP-13")
def user = authenticationContext.getLoggedInUser()
def issueFactory = ComponentAccessor.getIssueFactory()
def issueService = ComponentAccessor.getIssueService()
def pid = new Long(10000)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customfield = customFieldManager.getCustomFieldObject("customfield_10837")
def customfieldValues = issue.getCustomFieldValue(customfield)
for (value in customfieldValues) {
def newtask = issueFactory.getIssue()
newtask.setProjectId(pid)
newtask.summary = value
newtask.description = "issue description"
newtask.setIssueTypeId("10002")
newtask.setAssigneeId("elifcan")
newtask.setReporterId("elifcan")
newtask = issueManager.createIssueObject(user, newtask)
newtask.store()
issueLinkManager.createIssueLink(issue.getId(), newtask.getId(), 10000L, 1, user)
}
Of course, you will need to change the necessary information like issuetype Id, project Id, etc.
Regards,
Elifcan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.