I have a global transition named "2 Resolve". I also have screen named "Resolved Screen".
How can I create Workflow Condition such that transition screen (Resolved Screen) is visible during "2 Resolve" only if the the condition is true.
Hi @Kedar Kanel
To create a conditional transition screen in Jira, you'll need to configure conditions in your workflow. Conditions in Jira workflows control whether a transition should be available to a user based on specified criteria. Here are some Atlassian documents for your reference:
I hope this will help.
Hi @Emily _ DevSamurai yes Conditions in Jira workflow control whether a transition should be available to user or not.
I want the transition to be visible all the time but only trigger the Transition Screen if certain condition is met.
Is it possible to set/remove screen to workflow transition using script? That would also solve the problem. Then I could create Scriptrunner Behaviour and set or remove screen to the required workflow transition.
Hi Kedar,
Having the transition screen dynamically set for certain issue types in the same transition by a script is impossible, as Atlassian does not provide any Rest APIs to do this.
Regards,
Kristian
Hi Kristian,
How about
from
How is it used? When I tried to use it I got following error
groovy.lang.MissingMethodException: No signature of method: static com.atlassian.jira.bc.workflow.DefaultWorkflowTransitionService.setScreen() is applicable for argument types: (String, com.atlassian.jira.issue.fields.screen.FieldScreenImpl...) values: [testTransition, [FieldScreenImpl Test Screen], com.atlassian.jira.workflow.ConfigurableJiraWorkflow@5512a465] Possible solutions: setScreen(java.lang.String, com.atlassian.jira.issue.fields.screen.FieldScreen, com.atlassian.jira.workflow.JiraWorkflow)
Here is my code
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.workflow.WorkflowManagerimport com.opensymphony.workflow.loader.ActionDescriptorimport com.atlassian.jira.bc.workflow.DefaultWorkflowTransitionServiceimport com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.fields.screen.FieldScreenimport com.atlassian.jira.issue.fields.screen.FieldScreenManagerWorkflowManager workflowManager = ComponentAccessor.getWorkflowManager();def workflow = workflowManager.getWorkflow(issue);String workflowName = workflow.getName();log.warn("Workflow name: " + workflowName);def wfd = workflow.getDescriptor();log.warn("Current action name: $wfd");def allactions = workflow.getAllActions()log.warn("All actions ID and names" + allactions.collect {it.name+ ' '+ it.id})def actionName = wfd.getAction(31).getName(); // Replace with actual workflow transition IDlog.warn("Current action name: $actionName");def fieldScreenId = 10100 // Replace with the actual field screen IDFieldScreenManager fieldScreenManager = ComponentAccessor.getFieldScreenManager()FieldScreen fieldScreen = fieldScreenManager.getFieldScreen(11600) // Replace with actual screen IDlog.warn("Field screen is $fieldScreen")log.warn("Field screen is " + fieldScreen.getId())def setScreen = DefaultWorkflowTransitionService.setScreen(actionName, fieldScreen ,workflow)log.warn("success")
I also tried actionDescriptor.setView(fieldScreenId.toString()) which got executed without error but it broke the workflow.
Below is the code for it
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.fields.screen.FieldScreenimport com.atlassian.jira.issue.fields.screen.FieldScreenManagerimport com.atlassian.jira.workflow.WorkflowManagerimport com.opensymphony.workflow.loader.ActionDescriptorWorkflowManager workflowManager = ComponentAccessor.getWorkflowManager()def workflow = workflowManager.getWorkflow(issue)String workflowName = workflow.getName()log.warn("Workflow name: " + workflowName)def wfd = workflow.getDescriptor()log.warn("Current action name: $wfd")def allActions = workflow.getAllActions()log.warn("All actions ID and names" + allActions.collect { it.name + ' ' + it.id })def actionName = wfd.getAction(31).getName() // Replace with actual workflow transition IDlog.warn("Current action name: $actionName")def fieldScreenId = 11600 // Replace with the actual field screen IDFieldScreenManager fieldScreenManager = ComponentAccessor.getFieldScreenManager()FieldScreen fieldScreen = fieldScreenManager.getFieldScreen(11600) // Replace with actual screen IDlog.warn("Field screen is $fieldScreen")log.warn("Field screen is " + fieldScreen.getId())// Use ActionDescriptor to set the screen associationdef actionDescriptor = wfd.getAction(31) as ActionDescriptor // Replace with actual workflow transition IDactionDescriptor.setView(fieldScreenId.toString())log.warn("Success")
@Kedar Kanel - Here is a related article that helped me when I was attempting to show a transition screen conditionally based on a custom field value...this got me where I needed to be.I hope it helps you!
https://community.atlassian.com/t5/Jira-Software-questions/Show-transition-screen-conditionally-based-on-field-value-in/qaq-p/686294
It looks like you're new here. Sign in or register to get started.