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.
@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!
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.workflow.WorkflowManager
import com.opensymphony.workflow.loader.ActionDescriptor
import com.atlassian.jira.bc.workflow.DefaultWorkflowTransitionService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.screen.FieldScreen
import com.atlassian.jira.issue.fields.screen.FieldScreenManager
WorkflowManager 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 ID
log.warn("Current action name: $actionName");
def fieldScreenId = 10100 // Replace with the actual field screen ID
FieldScreenManager fieldScreenManager = ComponentAccessor.getFieldScreenManager()
FieldScreen fieldScreen = fieldScreenManager.getFieldScreen(11600) // Replace with actual screen ID
log.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.ComponentAccessor
import com.atlassian.jira.issue.fields.screen.FieldScreen
import com.atlassian.jira.issue.fields.screen.FieldScreenManager
import com.atlassian.jira.workflow.WorkflowManager
import com.opensymphony.workflow.loader.ActionDescriptor
WorkflowManager 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 ID
log.warn("Current action name: $actionName")
def fieldScreenId = 11600 // Replace with the actual field screen ID
FieldScreenManager fieldScreenManager = ComponentAccessor.getFieldScreenManager()
FieldScreen fieldScreen = fieldScreenManager.getFieldScreen(11600) // Replace with actual screen ID
log.warn("Field screen is $fieldScreen")
log.warn("Field screen is " + fieldScreen.getId())
// Use ActionDescriptor to set the screen association
def actionDescriptor = wfd.getAction(31) as ActionDescriptor // Replace with actual workflow transition ID
actionDescriptor.setView(fieldScreenId.toString())
log.warn("Success")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kedar
These Apis are for Jira dat center / server and will work on this but if on cloud they will not work.
I was not aware of these data center apis myself so thank you for suggesting these.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!
Help us plant more trees
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.