Hello,
I created a custom Number field and want to supply into it the total number of hours logged within a current month.
All seems to work (no failures) but the custom field always shows "None".
The expression used in Automation is:
{{logged("worklogDate >= startOfMonth()", "worklogDate <= endOfMonth()")}}
Add-ons role has all the permissions.
Any ideas on what could be wrong?
Hello @Dmytro Danylov
Can you please show us the entire Automation Rule? Often when something doesn't work as expected it can be traced to the context in which the step is running.
Can you show us the Audit Log for an execution of the rule?
Hi @Trudy Claspill ,
Sure, please see below. Let me know if other info is needed.
Here's execution log:
Here are the worklog records on the ticket:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for showing us the rule.
Where did you get information about the logged function you are trying to use in the Create Variable action? I am not familiar with that function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good point, there was a reference on the web, but I can't find it now.
Is there a way to use some other command/function to achieve the same result?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Natively Jira doesn't have a function to select worklogs that are within a specified date range.
What problem are you trying to solve by recording in the issue a total amount of time logged for an issue for the "last month"?
Could you accomplish your ultimate goal by using a third party app that would add functionality that helps you report on the time logged per issue in a specified date range?
If you must record the monthly total in a custom field in the issue, you could potentially create automation rule(s) that are triggered by the logging of work, deletion of worklogs, and editing of worklogs and use those to immediately update a Month Total Time field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am sure there are third party apps available, but I was hoping to solve the riddle using Jira standard tools.
Referring to your above suggestion, what function could I use to update Month Total Time field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You would use the Automation for Jira feature.
Automation rules have a variety of Triggers, Conditions, and Actions available. You would start by selecting the Work Logged trigger.
You could then add steps (conditions/comparison) to determine if the Work Log is within the time frame that you want to add to your Total Time.
You would then add an Edit action to update your Total Time field, adding to it the value of the current worklog.
The tricky part is that the new work log is going to be for this month, not last month. So you might need two fields; one for "last month" and one for "this month". You could write an Automation Rule to roll over the value from "this month" to "last month" when a new month starts.
And you have to decide what you want to do when work log entries are edited or deleted, if those actions are allowed in your system.
None of this will help you calculate the total time for last month retroactively. This would only help you going forward.
Another option to look at is using the REST API to extract work log information.
You didn't tell us what problem you are trying to solve, so the above is somewhat generic advice for addressing your requirement to fill in a Last Month's Time field without understanding why you need the information or how it needs to be used. I think it is important to understand the root problem you are trying to solve by recording total time worked on an issue in the past month. If we know the root problem we might be able to give you better advice for achieving your goal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The goal is to be able to see per ticket:
I was hoping to avoid going more complex route with REST API.
That's why tried using Automation as you are suggesting and was trying to figure out a way to retrieve the number of hours logged within a period.
I suspect what you are suggesting is to add/subtract to/from the field's value every time some worklog event takes place.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suspect what you are suggesting is to add/subtract to/from the field's value every time some worklog event takes place.
Yes, that is what I'm suggesting.
I cannot think of a way to gather all the worklogs for an issue, figure out retroactively which ones are for last month and which for the current month, and sum the values by month, all in an Automation Rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see. So in this case it sounds like I will need three rules: one for worklog added, second for it being deleted, third for it being edited. Or there's a way to do it all in a single rule?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The one Work Logged trigger works for all three.
I haven't actually worked through all the details so I don't know for sure how or that it is possible to code the one rule to handle all the conditions of:
- work log created - would be adding time to total.
- work log updated - might have to determine if the work log time was reduced or increased.
- work log deleted - reducing the total time by the amount of time that was in the deleted work log.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.