Hi,
i'm in desperate need of help. I'd like to fill a custom field with a number from my issue title.
I'm sending mails to Jira, with a fixed subject "blablabla bla bla 1245", i want every created issue in jira to check if the title field starts with "blablabla" and if it does it should put the what ever number is in the title into a custom field.
I can get to the part where i need to fill in the custom field but i dont know how to parse for the 1245 or what ever number is at the end. The number i need is allways at the end and without spaces
any ideas?
I think a plugin like JWT can potentially get you there depending on your use case.
from your example above, this function replaces a specific regex with nothing, so taking out all characters and spaces will leave you with the number which you can then assign to whatever field you like.
And with JWT you can do a condition on the function to only run when a specific thing occurs, in your example, if the summary has "blablabla"
You can also potentially use JIRA Automation if you do not have JWT or do not wish to install a new plugin. This answer has an example of using regex in automation: https://community.atlassian.com/t5/Jira-Software-questions/String-replace-in-fields-for-Jira-Project-Automation/qaq-p/1191599
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey thanks for the answer, im pretty sure that i am on the corret path thanks to your example still having issues getting the the parsing to work though
i tried to figure it out with the other post and 'm using something like this rn:
{
"fields": {
"description": "{{issue.summary.jsonEncode}}",
"customfield_10050": {
"Niederlassungsnummer": "{{issue.description.match("(?:.*)\s(\d+)")}}"
}
}
}
but i get an error message functionvalue has to be a string
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have a different solution for you that I was able to try successfully in my test environment
The regex reads: {{issue.summary.match("(\d+)(?!.*\d)")}}
basically only get the last digits in a string where there are no non digit characters, so it wouldn't get digits in the middle of the string, just at the end.
This worked great in my test environment, have it on issue create for the value changing and you'll be good to go!
Credit to: https://stackoverflow.com/questions/5320525/regular-expression-to-match-last-number-in-a-string
Hope that helps!
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.