To calculate the Block duration

Divya S M
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 25, 2024

Hi All,

I am trying to calculate the Blocked duration of a JIRA ticket from the blocked start day till Blocked end day. I have 3 new custom fields for Blocked Start date, Blocked End date, Blocked Duration. 

I have 2 different automation rules written for each custom fields.

1) when Issue transitioned from "any status" to "Blocked" - I am stamping my Blocked Start-Date

2) when Issue transitioned from "Blocked" to "any status" - I am stamping my Blocked End-Date

My question is, How do I calculate my duration?

I tried calculating it in my second rule, but for some reason Blocked End-date doesn't get passed in the calculations. (assuming, we cannot assign and use the same custom_field for calculations in single rule?)

I tried having "field value changed" trigger for Blocked-end-date, but since the value will be empty for first run of blocked end-date, this attempt also doesn't work

P.s, I am using [[{issue.Blocked end-date.diff(issue.blocked date).abs}+1]] calculations to calculate my duration.

can anyone please help me in resolving this?

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2024

Hi @Divya S M -- Welcome to the Atlassian Community!

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

 

The smart value expression you show is both missing the units of measure (e.g., days) and has the incorrect syntax.  Please look here to learn how to perform a date / time difference:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-difference---

 

Next, smart values are name, spacing, and case-sensitive.  And, they sometimes do not exactly match the field's display name on the Jira views.  When an incorrect smart value is used, it is replaced with null, often leading to unexpected behavior and often no errors in the log.

I recommend confirming you have the correct smart values for your fields using this how-to article.  Essentially the steps are:

  • identify an example Jira issue with your field
  • using a web browser, call the REST API issue function to see the smart values, substituting in your Jira URL and issue key
yourJiraURL/rest/api/2/issue/yourIssueKey?expand=names
  • search on the page for your field, such as with Control-F, to find the smart value and custom field id
  • update your rule accordingly

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer