Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Copy worklogs from the current issue to the new issue in “Create / Clone issue(s) (JMWE app)” post-function.

This article explains how to copy work logs from the current issue to the new issue in Create / Clone issue(s) (JMWE app) post-function.

Instructions

  1. Navigate to the intended workflow to make the necessary changes in the edit mode.

  2. Select the required transition.

  3. Select the Post functions tab and click Add post function.

  4. Add the “Create / Clone issue(s) (JMWE app)” post-function.

  5. Fill in the required details.

  6. Select the checkbox “Run a Groovy script after the issue is created” under “Post-creation script” and add the below “Post-creation script:”

    import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.worklog.Worklog import com.atlassian.jira.issue.worklog.WorklogImpl2 import com.atlassian.jira.issue.worklog.WorklogManager List<Worklog> worklogs = ComponentAccessor.worklogManager.getByIssue(issue) worklogs.each { worklog -> Worklog newWorklog = new WorklogImpl2(newIssue, null, worklog.authorKey, worklog.comment, worklog.startDate, worklog.groupLevel, worklog.roleLevelId, worklog.timeSpent, worklog.updateAuthorKey, worklog.created, worklog.updated, worklog.roleLevel) ComponentAccessor.worklogManager.create(currentUser, newWorklog, null, false) newIssue = ComponentAccessor.issueManager.getIssueObject(newIssue.id) }

With this: A new issue is created with the configured details when the transition is executed and work logs are copied from the current issue.

References