New String and Date functions in Automation for Jira

We like to continuously improve things, both big and small. Available now are some nifty new functions you can apply to your Smart Fields.

Smarter Strings

We added over ten new convenience functions that you can use in your Smart Field Strings. Smart Fields are a great way to manipulate your data for putting into email, chat messages or conditions. Want to truncate that description field so it fits in a chat message?

Use {{issue.description.abbreviate(50)}}. Need some nice padding for your text emails?{{leftPad}} to the rescue. You can use these functions in conditions as well, so if you want sum up a text field only if the field is a number, {{issue.Field Name.isAlphanumeric}} is your friend. Some of the existing methods have also been improved to be null / length safe, so calling {{substring}} with a number that's too large won't throw any errors.

The full list of new methods is below.

  • abbreviate
  • capitalize
  • startsWith / endsWith
  • lastIndexOf
  • left / right
  • leftPad / rightPad
  • remove
  • reverse
  • substring / substringAfter / substringAfterLast / substringBefore / substringBeforeLast / substringBetween
  • isAlpha
  • isAlphanumeric
  • isNumeric
  • isEmpty / isNotEmpty

Check out the full “Working with Strings” documentation for more details and examples.

It’s Business Time

We’ve also added two useful methods when dealing with dates. Sometimes you want to calculate time period between dates. Want to include the number of days the issue has been opened for in an email? Sometimes those dates needs to be specifically around business days. We’ve added two functions to help here, businessDaysBetween and daysBetween.

// Number of week days between now and issue created date
{{#now}}func=businessDaysBetween({{issue.created}}), format="toDays"{{/}}// Number of days between now and "My custom date field"
{{#now}}func=daysBetween({{issue.My custom date field}}), format="toDays"{{/}}

If you need to (e.g. integrating with external systems), you can change the format to be toHours or toMillis or chain other date functions to it. For a full reference, check out the “working with dates” documentation.

Last modified on Feb 18, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.