Is it possible to Hide Transition Button but not actually disable the transition in a specific Status?
Here is a use case:
I have a ScriptRunner Post Function that once user Reopens a ticket (Move from DONE to REOPEN) it finds all issues that have dependencies (custom field called "Segment") and also reopens them.
My Re-Open workflow step pops up a screen to let user input reasons why they reopening the issue, but the dependencies issues are reopened using a different workflow transition using a ScriptRunner script and workflowTransitionUtil with workflow step called "DO NOT USE" for now
I would like to hide "DO NOT USE" button from the user but not disable the ability for the scriptRunner script to use this transition step as that user.
Is this even possible?
It may be easier to use IssueService to handle the transiton that way you can see in the logs if there are any errors. Please try transitioning the issues like below:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.workflow.TransitionOptions // replace with your issue here def issue = issue def issueService = ComponentAccessor.getIssueService() def currentUser = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser() def parameters = issueService.newIssueInputParameters()
// replace with id of the transition def actionId = 111 def transitionOptions = new TransitionOptions.Builder() .skipConditions() .skipPermissions() .skipValidators() .build() def result = issueService.validateTransition(currentUser, issue.id, actionId, parameters, transitionOptions) if (result.isValid()) { issueService.transition(currentUser, result) } else { log.warn result.errorCollection.errors }
I tried to use above codes to hide transition from user. As in our team flow we have two issues Parent and child. Changing status in child issue type will initiate status change of parent issue type. But due to hiding transition in parent issue type, status not moving.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pawel,
From what you've described, this definitely seems like something that is already built-in to ScriptRunner. If you go to the workflow step that you want to edit and click "Add Condition", you should see one called "Hide transition from user": This will make it so that the user won't be able to click the transition button, but you can still transition through the workflow using other means.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Joshua,
I have tried this method, however when I reopen my issue using my reopen workflow, I get an error:
org.ofbiz.core.entity.GenericTransactionException: Commit failed, rollback previously requested by nested transaction.
The error pops up on top of my reopen window as follows:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pawel,
Do you get this error message without the condition in place? Can you try removing what Joshua suggested and see if you still get the same error?
Thanks,
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adam,
I do not get this error message without the condition in place.
With the condition, it produces stack trace, but it is too big to add to this message, not sure how to add it to help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pawel,
Can you provide more details about the post-function you are using to reopen the ticket? The script or screenshot would be useful.
Am I right in thinking this is the only customisations you have on this flow?
Thanks,
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adam,
High level, in a Post function of my Reopen script, I check against custom field called "Segment" a value, then based on that value, I check a bunch of if statements and generate and use the JQL to find "issues". "issues" is an array of keys to the project that are in a closed state but have the dependency. This is the part that does the reopening of the issues from the array of issues:
if (issues) { log.debug("The segment is: "+issues) issues.each { arrayIssue = ComponentAccessor.getIssueManager().getIssueObject(it.toString()) MutableIssue issueFromKey = issueManager.getIssueObject( "$arrayIssue" ) as MutableIssue log.debug("The issue: "+arrayIssue+" was auto-reopened by a post-function due to dependencies") workflowTransitionUtil.setIssue(issueFromKey as MutableIssue) workflowTransitionUtil.setUsername(currentUser) // 111 == AUTO-REOPEN ISSUE (DO NOT USE BUTTON) int workflowStep = 111 workflowTransitionUtil.setAction(workflowStep) // validate and transition issue if (workflowTransitionUtil.validate()){ workflowTransitionUtil.progress() } } }
My "Reopen" Transition ID = 71 and the "DO NOT USE" Transition ID = 111. Note that Transition ID 71 has a screen, hence I have to separate them as I haven't figured out a way to use automation to reopen ignoring the screen.
Let me know if this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It may be easier to use IssueService to handle the transiton that way you can see in the logs if there are any errors. Please try transitioning the issues like below:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.workflow.TransitionOptions // replace with your issue here def issue = issue def issueService = ComponentAccessor.getIssueService() def currentUser = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser() def parameters = issueService.newIssueInputParameters() def actionId = 111 def transitionOptions = new TransitionOptions.Builder() .skipConditions() .skipPermissions() .skipValidators() .build() def result = issueService.validateTransition(currentUser, issue.id, actionId, parameters, transitionOptions) if (result.isValid()) { issueService.transition(currentUser, result) } else { log.warn result.errorCollection.errors }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adam,
This actually works great, it allows me to hide the workflow button, and it transitions the issue(s) correctly. Thank you for your help.
Pawel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pawel,
That's good to hear.
I've made my response an answer so you can accept it. That way other people can easily see the solution.
Thanks,
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have copied the same code we are facing issue that transition is hiding and automatically parent issue status is also changing our attention is to hide transition's from parent and status will updating from sub-task automatically (i.e done).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I too have a similar question.
I have a transition hidden using condition but wanted to perform same using rest call.
how can I use rest call to perform that hidden transition?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.