Our new Appfire Documentation Space is now live!

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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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 desired workflow transition and add the “Create / Clone issue(s) (JMWE app)” post-function.

  2. Fill in the required details.

  3. 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

  • No labels