The goal is to count number of URL occurrences as plain text (number of "https://url.com...") and display those as a field.
To start learning I tried creating a smart value the dumbest possible way {{issue.NumberOfEdits}} and on case edit {{#increment}}{{issue.NumberOfEdits}}{{/}} but it doesn't look as it works?..
Hi @Mihail Turusov
I have not heard of NumberOfEdits before. Where did you see that one?
Another way to count those URLs is using the split function and counting the list items:
{{#=}}{{issue.description.split("https").size}}-1{{/}}
How this works:
Best regards,
Bill
Thank you for your reply.
That smart value is something I tried to create myself (when ticket is created - create smart value) to later operate it and to learn about them more.
I tried the rule you suggested and am getting an error (replaced https with URL of app domain):
Error rendering smart-values when executing this rule:
Failed to get value for issue.description.split("[https://app.intercom").size: {{#=}}{{issue.description.split("[https://app.intercom").size}}-1{{/}}
I believe I've done it properly?..
Also tried without a bracket and "https://" part and looks like it parses properly with it, but number is 2x as high (I believe because of doubled text and URL for text). Dividing it by 2 kinda work, but how do I modify the rule so it won't break for "[https://app.intercom" line?
Short version is that you may need to experiment a bit with this...
There are reserved characters that the split() does not like, but I have been unable to find documentation for the valid/invalid list. Perhaps they can be escaped, but I have not had success with that method. That is why I only searched on "https" in my example.
One such reserved character is the period (.), and so when I need to split on that, I first perform a substitution and then split:
{{#=}}{{issue.description.replace(".", "ZZZ").split("ZZZ").size}}-1{{/}}
Perhaps you could perform some replacement of troublesome characters and then split using this method.
This is super helpful! thank you!
It looks like you're new here. Sign in or register to get started.