It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
Hello Eric.
This could be done through a custom script on the console.
I don't think we offer this kind of functionality. This is some pretty custom stuff.
If i were you I would load the data through a JSON and send it through a SR Rest Endpoint. That's your safest bet.
Hope this helps.
Cheers!
Dyelamos
Hi,
Just use the custom field value and create the issues on the projects that you have selected.
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
CustomField cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_xxxxx");
if (issue.getCustomFieldValue(cf) == null) {
/* No objects selected */
return;
}
issue.getCustomFieldValue(cf).each{projectObject ->
def name = projectObject.getName();
/* Create the issue code depending on
the project name or any attribute
sepecified on the objects */
}
You can also look into the Insight JAVA API if you need to get more information stored as attributes on the objects.
Look at https://documentation.riada.se
Cheers //Mathias
Hello Eric
That error could be that the console doesn't know what class projectObject is.
Could you save the script and try to see if it works, even though it gives you that inline error?
Cheers
Dyelamos
Getting close!!!
I have the script creating subtasks based on a jira multiselect list. I really need to convert that to an Insight multiselect field and copy attributes into the summary field of the newly created subtask.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
def customFieldManager = ComponentAccessor.customFieldManager
def cf = customFieldManager.getCustomFieldObjectByName("Multiselect Field Sites") // This needs to me changed to a multiselect Insight field
def summariesList = (issue.getCustomFieldValue(cf) as Collection<Option>)*.value
Issue parentIssue = issue
//if the parent issue type name IS NOT Task - do nothing
if (parentIssue.getIssueType().getName() != 'Task')
return
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def groupManager = ComponentAccessor.getGroupManager()
def issueFactory = ComponentAccessor.getIssueFactory()
def constantManager = ComponentAccessor.getConstantsManager()
def issueManager = ComponentAccessor.getIssueManager()
def subTaskManager = ComponentAccessor.getSubTaskManager()
summariesList.each { subTaskSummary ->
MutableIssue newSubTask = issueFactory.getIssue()
newSubTask.setSummary(subTaskSummary + ": " + issue.getSummary())
newSubTask.setParentObject(parentIssue)
newSubTask.setProjectObject(parentIssue.getProjectObject())
newSubTask.setIssueTypeId(constantManager.getAllIssueTypeObjects().find {
it.getName() == "Sub-task"
}.id)
// Add any other fields you want for the newly created sub task
Map<String,Object> newIssueParams = ["issue" : newSubTask] as Map<String,Object>
issueManager.createIssueObject(user, newIssueParams)
subTaskManager.createSubTaskIssueLink(parentIssue, newSubTask, user)
}
The ideal solution would allow a user to select multiple "Field Sites" (multiselect insight field), create subtasks for each of those selections, then add the Field Site object to the correct subtask.
For example:
User selects field sites: Atlanta, New York, DC
Subtask for Atlanta with field site object "Atlanta"
Subtask for New York with field site object "New York"
Subtask for DC with field site object "DC"
Does that make sense?
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.
Read moreAtlas Camp is our developer event which will take place in Barcelona, Spain from the 6th -7th of September . This is a great opportunity to meet other developers and get n...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.