Is it possible to add or subtract the date/time from a custom field?
What is needed:
When the ticket is moved to a specific status we populate a date/time field (call it field A) using the smart value {{now}}. Later when the ticket moves out of that status, we get the difference between now and when the ticket entered the status, again using smart values.
(The problem is in this part) We need to then add up the difference that we just got to a date/time field (call it field B) which already has a value.
Example:
Any other suggestions that will solve this problem in a different way are welcome. Using a plugin is not an option.
I was looking into this document but I could not find a solution: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/
Using JSON in the "Edit issue" module in automation rules is also considered.
We need all of this to be part of Jira automation since the calculation needs to be done real time for thousands of tickets.
Thank you very much for the help.
Hi @Danilo Simic - I'm a little confused about the scenario since you're using "Field A and Field B" and it doesn't really make sense to me what you're actually trying to track.
A real world example using the actual fields you are trying to track may lead us to a solution that is simpler.
But just to answer your questions, you can find a difference between now() and a date from another field by using the diff command, as described on that page you referenced.
And you can add time to an existing field by using the plus* command. So I think I achieved what you wanted by creating an Edit Issue action for Field B with the following Smart Value:
{{issue.Field B.plusMinutes(issue.Field A.diff(now).minutes)}}
Please let me know if this works!
Hi @Darryl Lee
Sorry about the confusing explanation.
This will solve my problem. I could not find a smart value expression for adding up two date/time fields.
To further elaborate. We now have a field called "Expected Restoration Date" which is a date/time field type. Based on ticket priority we calculate the date/time for "Expected Restoration Date" (Example: If priority is Blocker then we add 8 hours to the ticket created date and fill in "Expected Restoration Date").
However this had the problem that the time in "Expected Restoration Date" field was never updated (it does not account for the time while we are waiting for the customer to provide more information).
So we wanted to include that calculation. The idea we came up with is creating a new field for storing the date/time of when the ticket is moved to the status "Waiting for Customer". Then based on that, once we transition the ticket to some other status we see how much time passed while the ticket was in that status and we add that time to "Expected Restoration Date".
Sorry for the text wall and for the bad explanation. I hope this clears things a bit.
Thank you very much for the smart value you provided. I think this is exactly what we need.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, that makes more sense now. Thank you! I'm glad I was able to help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Discover how Atlassian is revolutionizing service management with cutting-edge solutions for AI-powered support, HR Service Management, or DevOps connectivity.
Register here ⬇️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.