issue = finance
subtask= 1.bills due
2.bills cleared.
can i change the transition of the subtask (bills due ) to resolved automatically when the subtask ( bills cleared ) is resolved.
Hello @siva,
I wrote a script for you. This script works if there is a transition between subtasks' current status and resolved status. By the way, I thought there might be more than 2 subtasks. Therefore, I used for loop. Hope this helps.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.user.ApplicationUser
import org.apache.log4j.Logger
Logger log = Logger.getLogger("Your script name")
log.debug ("Script started")
try {
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
Issue currentIssue = issue
if(currentIssue.getIssueTypeId() == "subtask id" && currentIssue.getStatusId() == "resolved status id"){
Issue parentIssue = currentIssue.getParentObject() // finance issue
List<Issue> subtasks = parentIssue.getSubTaskObjects()
for(Issue subtask : subtasks)
changeStatus(subtask,currentUser)
}
}catch(Exception e){
log.error(e)
}
private void progressTransition(Issue issue, ApplicationUser currentUser){
WorkflowTransitionUtil workflowTransitionUtil = JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class )
workflowTransitionUtil.setIssue(issue)
workflowTransitionUtil.setUserkey(currentUser.getKey())
workflowTransitionUtil.setAction("action id")
workflowTransitionUtil.validate()
workflowTransitionUtil.progress()
}
Regards
Orkun Gedik
Let me know if you need help. Good luck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You would need an automation, or even better a scripting add-on.
From there, sure you can and also much more.
Br
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
we are using BOB SWIFT CONFIGURATION and JSU,
but as i check the configuration , its confusing,
if i need to transition a second subtask to resolved if the 3rd sub task is resolved.
can you help me with the fields to choose
ose ( please check the screenshot)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not so familiar with BobSwift, however the link relation between two subtasks does not exits.
In theory they are not linked at all with each other. Parent/Subtask relation exists only 1to1 (parent to/from subtask)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
EXACTLY, so do i have to try any script , i think i can work it out with automation,
can you suggest any other options u are aware of ,
Thankyou.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have any possible scripting add-on?
I can gladly help with building the script.
If no, maybe someone else can relate to your current setup.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
we use script runner,
and tried automation only works for servicedesk.
if you can help me with the script that would be great.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This might be similar.
We have 2 blocking sub-task issue types. If one resolves, checks for the other, if also that is resolved, it transitions the parent.
Let me know if you need any help adapting it.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.config.SubTaskManager
import com.atlassian.jira.workflow.WorkflowTransitionUtil
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl
import com.atlassian.jira.workflow.IssueWorkflowManager
import com.atlassian.jira.util.JiraUtils
import com.opensymphony.workflow.loader.ActionDescriptor
import com.atlassian.jira.ComponentManager
Issue issue = issue
MutableIssue parent = issue.getParentObject() as MutableIssue
if(parent.getIssueType().getName() == 'Demand' && parent.getStatus().getName()=='Mandatory Reviews')
{
def otherIssueType = 'Information Security'
if(issue.getIssueType().getName()=='Information Security')
{
otherIssueType = 'IT Architecture'
}
Collection subTasks = parent.getSubTaskObjects()
for (Issue subtask : subTasks)
{
if(subtask.getIssueType().getName()==otherIssueType)
{
if(issue.getStatus().getName()=='Done' && subtask.getStatus().getName()=='Done')
{
def sdUser = ComponentAccessor.getUserManager().getUserByKey('robotuser')
int actionId
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class)
IssueWorkflowManager issueWflwMan = ComponentManager.getComponentInstanceOfType(IssueWorkflowManager.class)
Collection<ActionDescriptor> coll = issueWflwMan.getAvailableActions(parent,sdUser)
for(ActionDescriptor ad : coll)
{
if(ad.getName().equals('Admin Skip Reviews'))
{
actionId = ad.getId()
}
}
workflowTransitionUtil.setIssue(parent)
workflowTransitionUtil.setUserkey('robotuser')
workflowTransitionUtil.setAction(actionId)
workflowTransitionUtil.validate()
workflowTransitionUtil.progress()
}
}
}
}
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.