Hi,
Simillar to the below script runner sample(i,e Date of First Transition), is it possible to get the automated transitioned trigger(i,e user/source i,e kodbuild made commit 202 or Vivek Abraham started review - trigered the transition information) mainly ::
My issue History tab looks as below::
Status | In Progress [ 3 ] | CODE REVIEW IN PROGRESS [ 10300 ] |
Status | CODE REVIEW COMPLETED [ 10301 ] | Done [ 10001 ] |
package com.onresolve.jira.groovy.test.scriptfields.scriptsimport com.atlassian.jira.component.ComponentAccessor
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager() changeHistoryManager.getChangeItemsForField(issue, "status").find { it.toString == "In Progress" }?.getCreated()
Please share your feedback/inputs...
-Manju
Its possible to get those descriptions using the HistoryMetadataManager.
The following example should show you how to get this description for when Stash/Bitbucket transitions the issue to "In Review" when a pull request is created:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.changehistory.ChangeHistory import com.atlassian.jira.issue.changehistory.metadata.HistoryMetadataManager def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def changeHistoryManager = ComponentAccessor.getChangeHistoryManager() def historyMetadataManager = ComponentAccessor.getComponent(HistoryMetadataManager) List<ChangeHistory> allChangeHistories = changeHistoryManager.getChangeHistoriesForUser(issue, currentUser) def relevantChangeHistory = allChangeHistories.find { changeHistory -> changeHistory.getChangeItemBeans()*.toString.contains("In Review") } def historyMetadata = historyMetadataManager.getHistoryMetadata(relevantChangeHistory, currentUser) historyMetadata.getHistoryMetadata()?.description
It will show something like: (Automated transition triggered by pull request #348 in Stash)
It should work the same for other type of automated transitions.
Thanks for your prompt feedback Adam !
It really helping me to identify whether a JIRA issue transition is triggered manually by assignee or automatically from sub-version or crucible app links configured in my workflow.
But When a transition is triggered automatically, it ignores any conditions, validators or permissions configured on the transition - is there any way to handle the conditions/validations before the automatic transition becomes successful based on condition result(PASS or Fail)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The transition would be controlled by whatever plugin does the auto-transition, so you would need to ask whoever that is (there may be an option to not skip these).
It sounds like when they perform the transition automatically they skip permissions, validators and conditions. Theres not much we can do from ScriptRunner if this is what they are doing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This plug in is from Jira, They said at the moment, this is not possible to achieve in JIRA. This is not something we can set in the configuration and we have a feature request raised on this JSW-14579. Thanks again for your response !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.