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

How can I populate my custom fields using substringBetween?

Garrison Thomson May 24, 2022

I created two custom fields (Category and Practice) that I need to be populated with values from an email request (from the Description field). Everything I've read elsewhere suggests that using the substringBetween function will do this but I can't get it to work for some reason.

Automation rules:

  • Trigger: manual (for testing, then I'll change it to when Issue Created)
  • Action: Edit Issue
    • Choose fields to set
      • Category: {{issue.description.substringBetween(“:”,”.”)}}
      • Practice:{{issue.description.substringBetween(“-”,”’”)}}

My test Email request/Description contains:

Category:Data Question.
Practice-OSLC Practice'

 

I manually triggered the automation on my request but the custom fields Category and Practice do not populate. Is it obvious what I'm doing wrong?

Thanks for any help!

 

1 answer

1 accepted

2 votes
Answer accepted
Callum Carlile _Automation Consultants_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 25, 2022

Hi @Garrison Thomson , welcome to the community!

This looks like it should work - I've given it a go myself and have been able to successfully set the fields using the smart value:

text fields.png

I copied and pasted both mine and your smart values into notepad to see if there were any small differences, and I did notice one:

formatting issue.png

For some reason, your speech marks and apostrophes are slightly slanted (no idea if this is just a strange formatting issue between devices/keyboards/languages) but this may be what's causing the problem - I tried copying and pasting yours into my automation rule and it did not work.

Just as a test - try copying and pasting this exact text and see if it works for you

{{issue.description.substringBetween(":",".")}}

{{issue.description.substringBetween("-","'")}}

I'm intruiged to see how you get on with this, hope this helps!

Garrison Thomson May 25, 2022

Thank you so much for looking into this for me Callum. I tried copying/pasting the exact text from above but the fields still did not populate when I ran the rule.

I removed the smart values and tried just using text and that worked fine, so maybe there's something up with my custom fields that is preventing the smart values from working.

My two custom fields are a drop-down list and a short-text field. Maybe these types of fields aren't compatible with smart values? I'll be looking into this possibility further.

Thanks again!

Garrison Thomson May 26, 2022

Callum, when you created your custom fields, did you create them as the "Short text (plain text only)" fields, or something else?

Thanks in advance.

Garrison Thomson May 27, 2022

I got this to work. The issue was related to your original response Callum. I had to copy your smart values into notepad and then copy from there into my automation rule.

When I compared my original smart values with yours in notepad I saw something similar to what you saw:

Capture.PNG

Seems kinda weird, right?

Anyway, thanks so much for the help!

Callum Carlile _Automation Consultants_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 1, 2022

@Garrison Thomson I'm glad you've got it sorted!

Yeah it's quite strange behaviour, I'm not too sure why that would be happening. Could there be some kind of difference between your computer language and the language set on your Jira instance? Or are you using some kind of non-standard keyboard?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events