Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I am using a Jira Issue for a bug that records the client ids that have reported the issue in a custom paragraph field. If a client reports the issue multiple times, their client id will show up multiple times.
I am trying to setup an automation where if you manually trigger the automation, it prompts you to enter the client id number you are looking up. Then I want it to count the number of times that user entered client id appears in that paragraph custom field and export that number to another custom field.
I can setup the prompt but when it goes to return the count, there is no calculated response.
This is the automation I setup:
{{issue.customfield_11371.match(userInputs.searchcounter).size}} times
Example:
Customfield_11371 contains this data:
1234
7499
2468
6654
7499
I trigger the automation and enter 7499 but no response but the word "times:" appear I'm looking for it to enter 2 times into the new custom field.
Can someone assist me in telling me what I am doing wrong? Thank you
Hi @Philip Ng
Your rule is trying the user input field in the match() function but it is not in the correct format for the function's use of regular expressions. To solve this, first create a variable which wraps the input in parentheses and then uses that variable in the function.
The match() function does not support adding content from smart values and so this technique allows creating a dynamic regular expression.
Kind regards,
Bill
@Bill Sheboy I just noticed a small issue. If the number I search for only appears once in the array, it doesn't show the number in the search result. It only shows if there are two or more instances of it. Any way to get it to show the number 1 if it only appears once in the list?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I expect this is related to newlines and other characters in the text...which cause challenges for the regular expression handling of the match() function.
Let's make it super easy for match() to figure things out:
{{issue.description.replace("\n", " ").split(" ").match(varRegEx).size}}
That replaces the newline character with a space and then splits into a list of "words", reducing the scope match() checks to one "word" at a time.
I will update my earlier post to match this expression.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Philip Ng , thanks for your post.
What is the goal overall? You want to have a report of how many times the customer has logged the bug?
Do you have any apps available to help you with this? Like Jira Misc or ScriptRunner?
To me, this sounds kind of like a use case for a Listener to capture and analyse the data and then to edit a custom field or label to identify, ok, this bug was reported in customerA 12 times, 4 times in another customer, etc.
Looking forward to your reply.
Cheers
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.