How to trigger status update on a schedulle - jira

I need to automatically update statuses of issues that satisfy certain conditions (e.g. some custom date field in the issue is less than 30 days to the current date) in Jira Service Desk.
It seems like there is no suitable trigger available in the Workflow automation.
Can someone pls advise how this could be implemented?
We are using latest version of Jira running in a Cloud.
Thanks

You can add your own postfunctions to workflow transitions (in Groovy if i'm not mistaken). For that go to your workflow, select the transition and add a custom postfunction.
A different way (that may be a bit more complicated) is to work with the Jira REST API. There is also a jira-python lib that is using that API.
So you could write a script that checks all your tickets using JQL and updates these tickets according to your condition.
Syntax could be like this
def checkIssue(issue):
if issue.fields.status.name == "Done":
// do something
issues = jira_connection.search_issues("updates <- 1d")
for i in issues:
checkIssue(i)
Keep in mind that you can't simply set the status in the issue object, you have to make transitions according to your workflow. Could be like this:
jira_connection.transition_issue(issue, '212')
where 212 is the ID of your workflow transition.

Related

JQL: Show all sub-tasks of stories in current sprint

###Background###
I'm using Atlassian's Confluence to make a page where to display our teams subtasks. Subtasks that do not have the status Done will prevent the Sprint from being closed by the Scrummaster.
In our case, users do not assign values (like sprintvalue, assignee or status) with the same care as they do for stories and epics.
###Goal###
To make sure I have a list of all the subtask that would prevent a sprint from closing, I'd like to generate a list in confluence
All incomplete Sub-tasks -> that are part of a userstory -> which is the currently active sprint.
Currently, I have it set up like this:
type = sub-task AND status != Done AND parent =
The parent field only supports search by issue key or by issue ID, not by another query. This means that my original idea does not work:
type = sub-task AND status != Done AND parent = (type = story and sprint = "Sprint 1")
###Note###
I am in no position to use plugins.
Using Atlassian Cloud
###Answer###
As Kevin pointed out, and I already feared, this can only be done by using a plugin like scriptrunner. So far, the options seem:
Try and talk to admins, see if they can get clearance on a plugin.
Painstakingly input all the id's of the userstories in the JQL query. This will take a few minutes to set-up every sprint, but it is as much work as clicking every story for sub-tasks.
Try to find a way to visualize this in Jira itself. Since everything is bolted shut for users, this might not be as straightforward as it seems.
Unfortunately you will need a plugin to do that. I believe scriptrunner can do this, but there are surely others.
You might try an exotic workaround such as injecting data into your subtasks on transitions or other events of the parent issue. This way you can filter on the data in the subtask itself. However, I would not recommend this, as it can get very messy and it will be easy to get out of sync. Also, chances are large that you will also need a plugin for achieving that.
Another way of visualising this might be through a board in Jira. There you can visually see which subtasks are not done yet, and you might even play with quick filters, swimlanes or card colours to highlight some things.

Isn't there any way to execute a post function script for free?

I'd like to perform operations like automatically update a field based on another field's value (for example if the assignee field is empty automatically assign to a default, set an hidden "due date" field based on the release-fix start date, ecc.) or write a custom validator that does validations based on a combination of values.
Every time I go searching on the jira forum I find java fragments of code, so everything seems to be possible, but it seems it is only at one condition: to buy the script runner plugin!
It seems strange to me: of course this plugin seems to be doing a lot of boilerplate for you but...what if I want to make a little more effort but still not payng for something that, in my opinion, should be free? I'm already paying the software license...isn't there another way to perform such post actions?
Try MyGroovy. It provides similar features. For tasks like execution post-functions I suppose it would fits good.

Is there a way to setup custom triggers in Visual Studio Team Services/TFS?

I use VSTS/TFS for work and side projects and I wanted to setup a trigger/rule that would automatically move stories into a certain iteration when I move them from "New" to "Approved" or whatever column is associated with an active state. I know how to change the iteration manually but it would be way easier if there was a way to say something like this psuedocode:
if (workItem.State == "Active") {MoveToIterationActiveForTodaysDate();}
Ideally too, if this isn't too picky, I would like it to only run on initial move so I can reassign to a different iteration later if I wanted to.
If anyone has an easier way to do this too that accomplishes the same thing (moving items to an iteration without having to manually activate the story and move it to the desired iteration) that would work as well. I'm still figuring out the ideal way to manage VSTS/TFS. Thanks in advance
Using VSTS is able to customizable work item rules.
Whether it be automatically setting the value of certain work item
fields or defining the behavior of those fields in specific states,
project admins can now use rules to automate the behavior of work item
fields and ease the burden on their teams.
More details please refer this tutorial: Add a rule to a work item type
However, it works with fields in the work item, not able to move work item to different iteration or area directly.
There is no out of box feature could achieve your requirement with TFS and VSTS for now. You may have to customize TFS events/actions to achieve the same feature as right click the work item--select move iteration--choose iteration.
Moreover, you could also use some 3-rd party extensions/tools such as Giulio
suggested TFS Aggregator.
As of today, there is no built-in automation, so the community wrote some tools that react at TFS/VSTS events and run scripts.
I can suggest TFS Aggregator which is used by many organization throughout the world: I am one of the core contributor.

Jira JQL that returns date of status change

I'm trying to use JQL to measure cycle times (the Control Chart has other issues), so I need to get the date that an issue changed status. I see that one can use the CHANGED keyword to filter issues that have changed status on certain dates, but I see no way to actually list the date of the change as a column.
Any ideas? How would you guys address this lack of visibility into cycle time data?
There is no simple solution available in JIRA at the moment. See the issue https://jira.atlassian.com/browse/JRA-12825 for the whole discussion. The argumentation of Atlassian is the following:
There exists a product Service Desk that implements the SLA feature expressed here.
There are reports and additional plugins available that give similar information to this. See the JIRA Suite Utilities which give you a UI for each issue to see the transition summary.
JQL (JIRA Query Language) was intended to select all issues that match a query, not to select special information to these issues. You have to use the configuration of the table, if it is included there as a field of the issue (which it is not).
In addition to the suggestions from mliebelt there is another at https://answers.atlassian.com/questions/128370/how-to-capture-date-of-state-change-in-jira. It requires JIRA Misc Workflow Extenstions and uses the "Copy value from field to field" function to capture the transition date in a custom field.
There is a plugin in Atlassian Marketplace called Time in Status just for that purpose. The plugin prepares a report on how much time each issue spent on each status or assignee.
Time in status is useless if need to count of Jiras that changed status on that day. Time in status widgets is useless for this

JIRA Mark ticket as Accepted/Acknowledge

I've been looking for a way to have a user acknowledge a
ticket after it has been assigned to them. I don't know if
this is a built in feature or if there is a plugin that
will create a state/button for a user to accept a ticket
after it has been put in there queue. I would expect to
see something like this from the ticket window around
workflow or start progress but no amounts of digging
through configuration settings has turned anything
relevant up.
Does anyone know about this added functionality in JIRA?
Much thanks.
I did this by a custom workflow step. After an issue arrived to an assignee (with status New) he/she should move it to another step (with status Open). Until he/she does it, the issue is considered as not noticed/reached the assignee. Also I have had a report showing issues with New status for more than a predefined period of time.
I'm not aware of a ready-made plugin which performs similar task (perhaps, I should dig into my posts on Atlassian answers to discover some clues for other solutions).
As #Stan says above, a custom workflow is the way to implement this. The workflow functionality in JIRA is very flexible and as a result has a bit of a learning curve, but Atlassian's documentation is pretty good. Post back here if you need help.

Resources