Bhavya-org / Scripts

0 stars 0 forks source link

when an issue transitioned - then automatically assign #45

Open Bhavya-ss opened 1 week ago

Bhavya-ss commented 1 week ago

def issueKey = issue.key logger.info("Issue Key: " + issueKey)

// Define the target status we are looking for def targetStatus = ["In Progress"]

// Iterate over the changelog items for (item in changelog.items) { // Check if the field is 'status' if (item.field == "status") { // Check if the status was changed to one of the target statuses if (targetStatus.contains(item.toString)) { def author = event.user.accountId println(author)

        // Update the assignee to the author of the transition
        def updateResult = put("/rest/api/3/issue/${issueKey}/assignee")
            .header('Content-Type', 'application/json')
            .body([
                accountId: author
            ])
            .asString()

        if (updateResult.status == 204) {
            logger.info("Assignee updated successfully.")
        } else {
            logger.error("Failed to update assignee: " + updateResult.body)
        }
}

} }

sani-d commented 1 week ago

project = "FSB" and (updated < startOfDay(-2d) and updated < startOfWeek(-2d) or updated >= startOfWeek(3d)) AND status = "Business Review" AND "Team Name[Select List (multiple choices)]" = FS-Perlite