JIRA / Greenhopper update stories when sub tasks are updated - task

In my JIRA/Greenhopper, when i move a subtask under story to "In Progress" can I automatically move my story to "In Progress"?
Also when I've closed all the tasks in my story can it automatically move my a story to close.

What you want to do is add post-function to the task's workflow transition from "Open" to In Progress". The post-function should transition the parent User Story from "Open" to In Progress". I used the Jira Scripting Suite plugin and a Jython script to do something similar.
Your algorithm would go something like this:
parentUserStory = task.getParentObject()
if (parentUserStory.getStatusObject().getName() == "Open"):
inProgressTransitionID = 41 # This is the id of the transition from Open -> In Progress in the User Story workflow*
workflowManager = ComponentManager.getInstance().getWorkflowManager()
userStoryWorkflow = workflowManager.getWorkflow(parentObject)
usCurrentStep = userStoryWorkflow.getLinkedStep(parentObject.getStatus())
listOfActions = usCurrentStep.getActions()
for act in listOfActions:
if str(act) == "In Progress":
break
else:
log.debug("No match: " + str(act))
iIP = IssueInputParametersImpl()
issueService = ComponentManager.getInstance().getIssueService()
transitionValidationResult = issueService.validateTransition(issue.getAssignee(),parentObject.getId(),act.getId(),iIP)
Key points:
You don't want to arbitrarily change the issue status. That way madness lies. Instead, transition the issue through its workflow.
The actual code for making the transition happen is dependent on your Jira version and the language you choose. It can be complex. Copy-and-pasting the above will doubtless fail. Hopefully it's enough to get you started.
Extra resource: answers.atlassian.com.

currUser = ComponentManager.getInstance().getJiraAuthenticationContext().getUser()
currUserName = currUser.getName()
issueServiceObj = ComponentManager.getInstance().getIssueService()
issueParamImpl = IssueInputParametersImpl()
issueParamImpl.setAssigneeId(currUserName)
issueId = issue.getId()
transValiRes = issueServiceObj.validateTransition(currUser,issueId,91,issueParamImpl)
if(transValiRes.isValid()):
System.out.println("Transition validated")
transitionResult = issueServiceObj.transition(currUser,transValiRes)
else:
System.out.println("in else")
Please let me know , if I am missing something

Install a free JIRA Misc Workflow Extensions plugin
Edit your "In Progress" transition to add a Post Function to transition parent issue using the same "In Progress" transition (kind of a reference to itself).
Note: Prefer using transition id, as it silently fails if you have several transitions with the same name.

Related

Show Due dates for linked issues in Jira

I want to make a Confluence page which tracks my jira tickets and the issues that are linked to those tickets.
Till now I have done this:
project= ABC AND "Epic Link"= 'Epic1' AND status != 'closed'
I want to create a table that has Jira- key, summary, tasks, due date, status and linked issues.
I want to make sure that I show linked issues that are only linked to the current epic (that is Epic1) and also show the due dates of these issues.
I have tired doing this:-
project= ABC AND "Epic Link"= 'Epic1' AND status != 'closed' AND issuefunction in linkedIssuesOf(" "Epic Link" = Epic1 ")
but it doesn't seem to understand this issueFunction in or issue in
Can someone please help me out
Try using the following-
project = ABC AND "Epic Link" = Epic1 and issue in childIssuesOf("Epic1")

Update task item programatically in Sharepoint with CSOM

I want to update a task item programatically in CSOM. Item is updating but workflow is not triggering. I need just to open the item in sharepoint and save it. Then workflow is triggering.
List requestTasksList = MyWeb.Lists.GetByTitle("TestRequest Tasks");
List<TestRequestModel> testRequestList = new List<TestRequestModel>();
ListItemCollection ColListItems = requestTasksList.GetItems(Spqur);
ctx.Load(ColListItems);
ctx.ExecuteQuery();
foreach (ListItem task in ColListItems)
{
task["Status"] = "Completed";
task["TaskOutcome"] = "Approved";
task["PercentComplete"] = 1.0;
task["Checkmark"] = 1;
task.Update();
requestTasksList.Update();
}
ctx.ExecuteQuery();
This is the updated task item
As i said, When i click to save button, workflow is triggering and new task is creating.
I'm not sure if its typo but it should be
List requestTasksList = MyWeb.Lists.GetByTitle("TestRequest Tasks");
List<TestRequestModel> testRequestList = new List<TestRequestModel>();
ListItemCollection ColListItems = requestTasksList.GetItems(Spqur);
foreach (ListItem task in ColListItems)
{
task["Status"] = "Completed";
task["TaskOutcome"] = "Approved";
task["PercentComplete"] = 1.0;
task["Checkmark"] = 1;
task.Update();
}
ctx.ExecuteQuery();
We needed to do the same thing and have found that there are no event handlers on the workflow tasks list in SharePoint 2013. I know that there is a SPWorkflowAutostartEventReceiver on lists that have workflows auto start on add or update, so I assumed this same approach would be done for workflow tasks as well, but it is not. Since there are no event handlers on the workflow tasks list, I surmise that all workflow triggers are initiated from the server-side UI code on the task list (horrible design).
For us we need to work completely client side with no farm solution or sandboxed code. So our only solution has been to screen scrape URLs and then open pages or dialogs for the user to do things like cancel all tasks for an approval workflow. Granted, this approach still does requires user input. I suppose you could screen scrape the whole page and play back the action of hitting buttons on a task page or cancel task page if you needed to avoid user input. That would be a pain, though.

JIRA JQL - Find all subtasks that are in X status, where the parent is in X status

I'm having an issue where I can't see the status of the parent task, and can only see the status of the sub-task. I would like to find all sub-tasks that are in a certain 'status' where the parent of that sub-task is (or is NOT) in a certain 'status.' Is this possible?
i.e. I would like to find all sub-tasks that are currently in the status "Assigned", where the parent of the sub-tasks is NOT in the status "In Development"
I have tried to Google the problem, as well as check through SF, but did not find anything. The only similar question that I found was "JIRA JQL - Find all subtasks that are open where the parent is closed" which was answered by #g.dlugoszewski:
type = sub-task and status = Open and issueFunction in subtasksOf("status = closed")
Yes, I'd use the Script Runner add-on with its custom JQL functions such as the one you quoted. Perhaps like this
type = sub-task and status = Assigned and issueFunction in subtasksOf("status != \"In Development\"")
Try something like this:
status = "To Do" AND type = sub-task AND issueFunction in subtasksOf("status = 'In Progress'")
In this case the status = "To Do" for sub-tasks and 'In Progress' for parent tasks. Change for what status you want.
Referencing a saved filter might help you, e.g. status = X and filter != "My Saved Filter"

How to change the status of a Context.sublime-menu item on Sublime Text?

I've wrote a plugin with a context menu which changes by the situation, does exists some way to do that?
plugin_menu = sublime.load_settings('Context.sublime-menu')
children = plugin_menu.get('children')
children[0]["caption"] = "Message changed"
plugin_menu.set('children', children)
sublime.save_settings('Context.sublime-menu')
I've tried with load_settings which loads it correctly but it doesn't save it, basically because it is not the right way to do it and load_settings probably should be used for .sublime-settings files.
You would have to create a command for each action, but you may be able to leverage the is_visible method. Here is an example of it's usage.
class AdvancedNewFileAtCommand(sublime_plugin.WindowCommand):
def run(self, dirs):
if len(dirs) != 1:
return
path = dirs[0]
self.window.run_command("advanced_new_file", {"initial_path": path + os.sep})
def is_visible(self, dirs):
settings = sublime.load_settings("AdvancedNewFile.sublime-settings")
return settings.get("show_sidebar_menu", False) and len(dirs) == 1
I check for a setting and the number of directories specified. This particular example is used to selectively display a Side Bar context menu.

how to find JIRA issues that were opened on specific stories, when this story list is changing

We are working with green hopper and have Stories. When a Bug is opened it is linked to a story through the 'Story Label' field.
Now I would like to create a query that will show me all bugs related to a sprint, meaning all bugs that relate to the Stories assigned to the sprint.
Here is the query to get all stories:
project = TMP AND issuetype = Story AND fixVersion = 11113
And Here is the query to get all bugs of a story:
project = TMP AND issuetype = Bug AND "Story Label" = jim-887
How do I combine both?
You may want to look at the third-party JQL Tricks plugin. It has a function, hasLinks(), that you could use. For example:
project = TMP and issuetype = story and fixVersion = 11113 and linkedIssuesInVersion(11113,"bug related to story")
More on the usage of that in this blog post.
Thanks,
Nicholas Muldoon
#GreenHopperTeam
Try the following (extraneous spacing added for clarity):
project = 'TMP' and(
(issuetype = Story and fixVersion = 11113) or
(issuetype = Bug and "Story Label" = jim-887)
)

Resources