Automation rule to fetch the date from a string and store it into a date field

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

This article describes an automation rule to fetch a date value from a string and store it in a date field.

Solution

We will use smart values to separate the date value from the string. We can use the functions available for text fields depending on the format of the string and the position of the date value.

For example, if the date value is present at the end of the string and separated by a "-", we can use the substringAfterLast function. The below functions can be utilised depending on the position of the date field:

  • substringBetween: Returns the text between the given parameters. This can be used if the date is specified between specific characters.

  • substringAfterLast: Returns the text after the last occurrence of the given separator. This can be used if the date is present at the last of the string, and is separated by a specific character.

  • right(int length): Returns the characters, from the specified amount of characters, from the right of the text string. This can be used if the string ends with a date.

  • left(int length): Returns the characters, from the specified amount of characters, from the left of the text string. This can be used if the string starts with a date.

This list is not exhaustive and other functions may also fit your use case. Please refer to the documentation for the available functions for text fields.

The above functions will return text values. So, we convert it to date format when populating the required date fields using the toDate function.

Sample Rule:

Trigger:

Field value changed (Field that contains the string). In this rule, we're monitoring this field for any changes so the date fields can be modified accordingly.

You may use any other trigger that fulfils your requirements.

Conditions:

Add any required conditions to execute the rule for the required set of issues only. We can also add a condition to check that the field holding the string value isn't empty.

Condition: Custom Text field is not empty.

Actions:

  1. Edit the issue and store the separated date value in a text field using the above functions. In this rule, we're assuming that the date is present at the end of the string, after a "-" character. For example, the string is Test - 01/01/2025 Smart value: {{issue.fields.customfield_10133.substringAfterLast("-")}}

    Edit field with the smart value provided.
  2. Use a Re-fetch issue data action to fetch the latest field values after the text field has been updated.

  3. Edit the issue and update the date field(s) using the smart value: {{issue.customfield_10087.toDate("dd/MM/yyyy")}}

    Edit field to update due date using the smart value provided.

You may modify the date format as per the value stored in the text field. For example, if your string is Test-01.01.2025, edit the format in the last step to "dd.MM.yyyy".

Also, please ensure to replace the IDs of the custom field from your instance.

Updated on March 14, 2025

Still need help?

The Atlassian Community is here for you.