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))}}
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gotcha and thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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()}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.