Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,859
Community Members
 
Community Events
165
Community Groups

How can I populate my custom fields using substringBetween?

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

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!

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!

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.

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!

@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
Community showcase
Published in Jira Service Management

Improving the Create Issue Experience in Jira Service Management Cloud

Hello everyone!  We are very excited to announce some much needed changes to the issue create experience in JSM (the blue "create" button) at the top of the screen.  We have just starte...

208 views 7 7
Read article

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