Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jira Automate: Syntax for Text Manipulation

Hello,

I am attempting to define an automation rule such that when a request is submitted meeting certain criteria, the ticket description will be searched for formatted text following the phrase "Due Date: ", and that text will be used to set the ticket's Due Date.

For example, imagine that the description was simply "Due Date: 2020-12-03". The question would be what Smart Text rule to define in order to set the Due Date to 12/3/2020 (within the blank under "Edit issue").

Here's what I've worked out so far, which is probably completely off-base regarding the syntax for chaining smart text functions together, but which I hope illustrates what I'm after. In my searches, I couldn't find much in the way of examples for doing this sort of thing:

{{issue.description.convertToDate(substring({{#=}}indexOf("Due Date: ")+10,{{#=}}indexOf("Due Date: ")+19))}}

1 answer

1 accepted

0 votes
Answer accepted

For posterity, I figured this out. Here's what I wound up doing:

{{issue.description.substringAfter("Due Date: ").left(10)}}

Hi @Joshua Carr 

How are you handling missing/invalid values following the text "Due Date: "?  Perhaps with a condition before attempting to replace the existing field value?

Best regards,

Bill

I'm actually not. In this case, there's a form that feeds the field, and the form enforces DD-MM-YYYY formatting.

 

I imagine that it's possible to set things up to account for a degree of variant entry in case the date entry was free-text, but I imagine it would take a lot of work or would require use of already-developed tools. And of course typos are always possible in that case.

Like Bill Sheboy likes this

Gotcha and thanks!

@Bill Sheboy - As I continued work on this, I wound up needing to handle variable-length values. I did it by outputting all the non-whitespace characters between two string matches. Here's an example:
{{issue.description.substringAfter("Client Name:,").substringBefore("Account Executive:").trim()}}

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,121 views 8 28
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you