Take a date from a ticket summary and apply to Due Date
Asked by Mark Cartwright:

Hello,

<br />

We have a form for new starters that comes into on prem jira.

In the summary of the ticket the start date is populated by the form.  

Is there a way using automation to take that date and populate the Due Date field please?

<br />

Many thanks in advance,  
Mark


Answers:
author: Bill Sheboy
body: Hi [@Mark Cartwright](/t5/user/viewprofilepage/user-id/2505994)

Do you have automation for Jira installed in your instance? If so, you should be able to parse out the date from the summary and use it to see the Due Date.

If not, there is a free (lite) and paid (pro) version of the automation rules, and you could discuss with your site admin about adding the feature.

Kind regards,  
Bill

comments: author: Mark Cartwright
body: Hi Bill,

Thanks for the quick response.

We do have automation for jira installed and that's what I'm hoping to use but I have no idea how to parse the date out from the summary.

Can you advise or point me to info on how to do that please?

Kind regards,  
Mark


author: Bill Sheboy
body: Mark, I can try to do both!

If you provide examples of your summary, the community can give you ideas how to parse that with a rule.

Next, here are links to the server documentation for automation rules, the template library of rules, and a large list of automation references:

* <https://confluence.atlassian.com/automation/getting-the-right-version-993924597.html>
* <https://www.atlassian.com/software/jira/automation-template-library#/label/all/1453>
* <https://community.atlassian.com/t5/Automation-articles/Jira-Automation-all-the-resources-you-need-in-one-page/ba-p/1388465>


author: Mark Cartwright
body: Bill, thanks again for the response!

Unfortunately not been able to find what I need from the documentation you kindly gave me so here's the example of what I'd like to do.

The Summary of the ticket will always be in the same format as it's created by a mail sent via Power Automate. The summary looks like this:  

New Hire Form for \*user's name\* - \*universal date format\*

For example:

New Hire Form for Joe Bloggs - 2021-10-15

What I'd then like to do is use automation for jira to look at each newly created ticket, take that universal date and populate the Due Date field with it.

Would love to know how please.

<br />

Many thanks,  
Mark


author: Bill Sheboy
body: Mark, you should be able to extract that date using the right() function:

<https://confluence.atlassian.com/automation/text-functions-993924863.html#Textfunctions-rightright(intlength)>

For example with your summary layout:

```
{{issue.summary.right(10).toDate}}
```

The rest of the rule would be something like:

* trigger: issue created
* condition: ??? you probably want some type of condition here to limit which issues get processed. Otherwise everything created in the project will try to do this. Perhaps check that the {{initiator}} is who you expect to create the issue.
* action: edit the Due date to equal the smart value from above


author: Mark Cartwright
body: Thank you so much Bill, that works perfectly!


author: Bill Sheboy
body: Awesome! I am glad to learn that helped.


author: Hannes
body: Hello,

first thank you for the great work!

I have a similar problem, which can also be solved with the solution described. Unfortunately our date is in a different format. I have read that you can change the date format, but everything I tried so far failed. What should the query look like if the format from the date in the summary is not 2022-01-21 but 21.01.2022?

kind regards  
Hannes


author: Bill Sheboy
body: Hi [@Hannes](/t5/user/viewprofilepage/user-id/29468)

My suggestion would be to use [text functions](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/) to parse/convert the string into the standard Jira date format of yyyy-mm-dd and then use toDate on the result.

If you are using Jira Cloud with your automation rule, [Create Variable](https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-variable) would help for a working space location. For example, if we assume your date of dd.mm.yyyy format is in the summary, put this in a created variable, such as named varMyDate:

```
{{issue.summary.substring(7,10)}}-{{issue.summary.substring(4,5)}}-{{issue.summary.substring(1,2)}}
```

Then use the date with:

```
{{varMyDate.toDate}}
```

Kind regards,  
Bill


author: Harish ShanmugamDhanasekar
body: Hello [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) ,

I am able to grab date from the summary "Employee Termination Billy Bolton 2022-02-10,

Now If the ticket is unresolved before 2pm on the due date, I need to send notification to slack channels and some email address.

I know the integration of jira cloud with slack and email process.

Can you please tell me the logic on how to find before 2pm on due date?

So that afterwards I will include if the issue is not closed:

send notification.

I am stuck with the time logic. Please help me with that. Thanks in advance


author: Bill Sheboy
body: Hi [@Harish ShanmugamDhanasekar](/t5/user/viewprofilepage/user-id/4386953)

You can probably do that with the date time functions: resetting to start of day, adjusting the time with plusHours(), adjusting to your time zone, and the perform the check against {{now}} adjusted to your time zone.

<https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/>

I recommending starting with just writing to the audit log with a manually executed rule to get the syntax correct, and then add the condition to your production rule.

Kind regards,  
Bill


author: Harish ShanmugamDhanasekar
body: Hello [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) ,

I am able to grab the due date from the suggestion given by Darryl Lee.

But I want to run the trigger only at 2 pm on the last working day instead of running it daily at 2pm. Please help me with this.

<https://community.atlassian.com/t5/Jira-questions/How-to-extract-date-from-the-Summary-Field-in-Jira/qaq-p/1946675#M519371>

Thanks,

Harish.


author: Bill Sheboy
body: Thanks for that link...As Darryl is actively helping to solve that with you, let's stick with that thread, and I'll post my thoughts there.

Kind regards,  
Bill


author: Harish ShanmugamDhanasekar
body: Thanks a ton for your help [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)

Kind Regards,

Harish