Automation to calculate days between dates

Zaldy Parian
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.
December 1, 2020

Hi all,

I wanted to have an manually-triggered automation. The objective is to set the custom field [Days open] with numeric value calculating the difference of current date - created date.

Questions:

1. How can I calculate days between dates? I saw one post that suggested this:
// Gets the number of days between two dates
{{now.diff(issue.created).days}}
not sure where to put this.

2. Assuming I got #1 above sorted; How do I manually trigger the automation? I read that it can be triggered in issue detailed view https://support.atlassian.com/jira-software-cloud/docs/manually-run-a-rule-against-an-issue/
but i really could not find my automation from issue view.

 

2 answers

1 accepted

1 vote
Answer accepted
Andreas Knecht
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 7, 2020

Hi Zaldy,

 

So your on the right track. You'd basically have to setup a rule like this:

  • Trigger: Manual trigger
  • Action: Edit issue and add your target custom field and set it's value to the smart-value you provided (e.g. {{now.diff(issue.created).days}})

To trigger this you can simply click on "Rule executions" on the right hand side on an issue (if you are in Cloud) and run your rule (in server this can be found under the issue operations drop down where 'Edit issue' is located).

Hope that helps!

Cheers,
Andreas

Zaldy Parian
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.
December 7, 2020

Thanks, Andreas.

Got it now.  Cheers.

Like Deleted user likes this
Deleted user November 17, 2021

@Andreas Knecht  but if I wanted to make the rule automatic, instead of manual as you suggest. Can this be done? I've been trying for quite some time but first of all I realized that the 2013 report asking to be able to reset sla on Jira Service Management has not yet been resolved by Atlassian. So if I can not reset a sla, how could we solve, to make this automatic alert for the customer and tell him: "hey man, I've been waiting for three days for your answer". So that if the request goes from customer awaiting to in progress and then maybe back to customer awaiting, the count restarts for the three days?

1 vote
Zaldy Parian
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.
December 3, 2020

Or perhaps someone could suggest how to do this through post action in the workflow transition?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events