How to work out the date Difference

Matthew Hardy January 6, 2022

Hi,

 

Just looking for some help.

What I am wanting to do is work out the Number of days a quote has been submitted for against the current date.

 

I have a custom Field set up called (Date Quote Was Submitted By Brexons). 

With this we would then like to automatically work out how many days on a rolling day to day basis it has been submitted. 

 

Example: 

Date Quote was submitted (03/01/22)

Todays Date (06/01/22)

Number of Business days (3) - This would then go up in value as each day passes but only for business days. 

 

Would this be possible to do and if so, any help to achieve this would be greatly appreciated. 

1 answer

1 accepted

0 votes
Answer accepted
Marco Brundel
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.
January 6, 2022

Hi @Matthew Hardy ,

With a automation rule it is possible I think.

I've made a rule for the difference between two fields and uses the following in additional fields:

{

    "fields": {

        "Time To Market": "{{#issue.customfield_11500}}func=businessDaysBetween({{issue.customfield_11501}}), format=\"toDays\"{{/}}"

    }

}

 
Is this useful to you?

Regards, Marco

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.
January 6, 2022

Hi @Matthew Hardy 

Adding to Marco's idea, you could do this for time-to-current date/time with this:

{{issue.Date Quote Was Submitted.diff(now).businessDays}}

Please check your field name to confirm the smart value.  And, this assumes business days are Monday to Friday, 9am to 6pm.

Kind regards,
Bill

Like # people like this
Matthew Hardy January 7, 2022

@Bill Sheboy @Marco Brundel 

Thank you both for your response.

 

Sorry I am new to this. To achieve this would I need to create another custom field for the number of days to go into?

 

Further more, which trigger would be the best one to use when creating the automation rule and then for the action would it be "Comment on Issue"

 

Again thank you both for your help and sorry to be a pain. 

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.
January 10, 2022

Hi @Matthew Hardy 

What do you want to do with that value for the number of days?  For example, if you wanted to report/filter on it, you could calculate it with an automation rule and then store it in another custom field.

Regarding the rule trigger, you could check on a change to your "Date Quote Was Submitted" field, such as:

  • trigger: your date field changes
  • action: edit issue to store the calculated days in another custom field

Here are some automation references and examples to help you get started:

If you have challenges doing this, please post images of your rule and audit log so the community can help.

Like # people like this
Matthew Hardy January 11, 2022

Hi @Bill Sheboy 

 

Yeah we are wanting it to report on. We are using this to track to see how long the quote has been submitted for since being submitted as we will use this information to track our 75 Day quote period. 

 

The second custom field which is called "Number of Days Since Quote was Submitted". I have done this as a numbers field due to it just requiring a number in there.

 

I have attempted the automation rule and its run successfully however it doesn't fill in the empty custom field. Is there something I am doing incorrectly. 

 

Screenshot 2022-01-11 093703.pngScreenshot 2022-01-11 093715.pngScreenshot 2022-01-11 093734.png

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.
January 11, 2022

Matthew, I think you may have the incorrect name of the smart value for your field in the edit expression.

Please use this how-to article to find the exact smart value for your field: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Basically you find an example issue with your field, and then call the REST API from a browser tab.  That will show you what to use in the rule.

Like # people like this
Matthew Hardy January 18, 2022

@Bill Sheboy 

 

Thank you, I have managed to get this working now thanks to your help. Really appreciated. 

 

Thanks,

 

Matt

Like # people like this

Suggest an answer

Log in or Sign up to answer