addWorkLog

    Signature

    Helper workLogHelper
    Signature
    addWorkLog(String startDate, 
    String timeSpent,
     String workLogComment, 
    List workLogs)
    Description

    Adds a worklog to the worklogs list

    • Startdate is a date formatted 'yyyy/MM/dd'
    • timeSpent is a pretty formatted duration such as '1w 2d 3h 4m'
    Introduced in 0.12.0

    Example use

    Change Processor

    //when the source issue has original estimate set and the issue status is "Done"
    // log the original estimate as a workLog on the destination side
    
    
    if (replica.status.name == "Done" && previous.status.name != "Done") {
      issue.workLogs = workLogHelper.addWorkLog(
        (new Date()).format('yyyy/MM/dd'), 
        "${replica.originalEstimate / 60}m".toString(), 
        "Worked on the issue", 
        issue.workLogs
      )
    }
       // when the item is under warranty, log 2 hours by default
    
    if (replica.customFields.warranty.value == "Yes") {
       issue.workLogs = workLogHelper.addWorkLog("2015/05/22", "2h", "Consultancy", issue.workLogs)
    }