One of my customers asked me to help with their situation.
This company has a lot of customers with monthly "Time & Material" billing, which means all the worklogs from the customer's project from the previous month are taken and based on the sum of logged hours the invoice for customer is prepared.
To be able to prepare the invoice, all the work needs to logged in Jira no later than the tenth day of the following month.
But it happens occasionally logs are created later, which means these hours are not billed to the customer.
The company is in process of adopting Tempo Timesheets, which enables you
But the process of adopting needs some time and a few users are still not able to send the timesheets for approval on a monthly basis...
As a project leader you can be notified about all the changes in worklogs (based on the Jira's notification scheme), but if there a lot of changes, you don't want to read all the email notifications.
So I've prepared a special automation rule to notify the project leader, if somebody is trying to add the "old" worklog, so the project leader can react on this situation.
During the month there are two different situations:
I wanted to do some action based on worklog creation, so Work logged trigger is a definitely the right choice. There's also possibility to react only on some operations (e.g. only to creation, not modification or delete). In the end I've decided to react on all the operations, because it could also be interesting for the project leader to know about the modifications and removals of worklogs.
There are four dates I needed to work with:
Worklog start date
{{worklog.started}}
This smart value is available because I've used the Work logged trigger.
Today's day of month
{{now.dayOfMonth}}
First day of the current month (midnight of the date)
{{now.startOfMonth.withHour(0).withMinute(0).withSecond(0).withMillis(0)}}
First day of the previous month (midnight of the date)
{{now.startOfMonth.minusMonths(1).withHour(0).withMinute(0).withSecond(0).withMillis(0)}}
This can be done using the Advanced compare condition.
Smart value
{{now.dayOfMonth}}
returns the number, e.g. on the 25th February returns 25, we can compare it with any number:
{{now.dayOfMonth}} is less than 11
means the first situation - from 1st to 10th day of the month.
This can also be done using the Advanced compare condition.
I can simply compare two dates, which one is earlier.
I was asked to simply send email to the project leader.
It is possible to use some worklog smart values (these are available because of the used trigger) in the email's body like
{{worklog.comment}}
{{worklog.started}}
{{worklog.timeSpent}} (cloud only)
{{worklog.timeSpentSeconds}}
to add some information about the worklog. The most important is to provide issue's key using
{{issue.key}}
so the project leader knows, which issue is involved.
When: Work logged (all worklog operations)
If: all match
{{now.dayOfMonth}} is less than 11
{{worklog.started}} is less than {{now.startOfMonth.minusMonths(1).withHour(0).withMinute(0).withSecond(0).withMillis(0)}}
-> Then: Send email
Else-If: all match
{{now.dayOfMonth}} is greater than 10
{{worklog.started}} is less than {{now.startOfMonth..withHour(0).withMinute(0).withSecond(0).withMillis(0)}}
-> Then: Send email
In the Advanced compare condition you can always use regular expressions like:
(1[5-9]|2[0-5])
This means from 15th to 25th day of the month
It would help, if the variable with the date can be set, something like "if we are in the beginning of the month, set the variable to the first day of the previous month, else set the variable to the first day of the current month".
Even though it is possible to create variables in Jira cloud, I wasn't able to make this conditional behavior work.
Probably yes! There are so many possibilities for automation, so please let me know your thoughts and suggestions. Thank you!
Hana Kučerová
Atlassian Consultant
BiQ Group
Prague, Czech Republic
500 accepted answers
6 comments