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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Create multiple linked issues in postfunction with scriptrunner Edited


Based on count of values chosen in a field ("Test1" in my example) in customer portal, I need linked issues to be created, so that in case 3 values are chosen in customer portal, 3 linked issues should be created.

I solved the problem by using subtasks, but as subtasks in Service Desk do not support approval process, I need to use linked issues in stead of subtasks. Can you please help with some code? Here is my code, using subtasks:

IssueManager im = ComponentAccessor.getIssueManager()
MutableIssue issue = im.getIssueObject("SDAT-1156")
def customFieldManager = ComponentAccessor.customFieldManagerdef cField = customFieldManager.getCustomFieldObjectsByName("Test1")[0]
def cFieldValue = cField ? issue.getCustomFieldValue(cField) : "Field doesn't exist"
////     For Sub tasks  ////////
def constantManager = ComponentAccessor.getConstantsManager()
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issueFactory = ComponentAccessor.getIssueFactory()
def subTaskManager = ComponentAccessor.getSubTaskManager()
def issueManager = ComponentAccessor.getIssueManager()
Issue parentIssue = issuedef reporter = parentIssue.reporter.namelog.warn("The reporter is " + reporter)
log.warn "====================Start of Log=============================="
log.warn "Custom field value type or class" + cFieldValue.getClass()def cascadingSelect = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Group owner")
log.warn cascadingSelect
    MutableIssue newSubTask = issueFactory.getIssue()
 it.getName() == "Group-SubTask"
def newIssueParams = ["issue" : newSubTask] as Map<String,Object>
 // for JIRA v7.* and V8.*                                        
 issueManager.createIssueObject(user, newIssueParams)
 subTaskManager.createSubTaskIssueLink(parentIssue, newSubTask, user) log.warn "Issue with summary ${newSubTask.summary} created"
    log.warn "Group is: $i "
log.warn "Selected groups are: " +cFieldValue
log.warn "Reporter is: " + reporter
log.warn "====================End of Log=============================="


1 answer

0 votes

Hi @Maro Hamamjyan you may want to contact Adaptavist directly though their support portal.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

227 views 1 6
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