Greetings, community!
Who has a working example of using the Split function accessing the values in the result array?
I am able to split things, and I even figured out how to work around non-splitting characters. (For example, replace periods with another character prior to split.)
But, when accessing the values, the results are consistently:
Thanks for any help you can provide!
Example on how to extract the email domain of a reporter
{{reporter.emailAddress.split("@").get(1)}}
We use this in Jira Automation to exclude certain domains to be added to certain organisations
Thanks, this is really usefull. Was looking for this ;-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, @Peter Reiser for that example.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy @Peter Reiser I am also struggling with the regex split function. I am trying to use the split function on the "responders" custom field (I created a smart variable to make it more readable) in order to retrieve the user ID from the value. Unfortunately, my variables are always empty.
Do you have any idea what I am doing wrong?
Not even splitting by "user" gets me anything.
{{responders.split("user").get(1)}}
I suppose, I have to somehow point to the value of the responders field?
When I do a log action on "responders", I get:
Responders value is: {ari=ari:cloud:identity::user/<PROFILEID>, name=<PUBLICUSERNAME>, type=user, avatarUrl=https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/M-4.png}
But after using the split function, the new variable is always empty.
Here's the link to my problem that I am trying to solve.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @mb
To help focus the conversation, let's use your question / thread to help solve this. Thanks!
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, community!
After a comment from an Atlassian developer on another question, it appears the problem is the documentation for text functions, not the split() function itself. The gap may have been caused when the information was ported over after Atlassian acquired the automation product. Who knows...
Split produces a list, and lists are not accessed as .first, .second, etc. as described in the doc. Instead, they use function returns (note the parenthesis) and numerical, not literal indexing:
.first()
.last()
.get(n) where n is the 0-based index for the array.
Please see here for more details on list access:
https://support.atlassian.com/jira-software-cloud/docs/smart-values-lists/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Sheboy, you saved me a ton of stuffing around. Greatly appreciated!
Cheers,
Nick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nick, I am glad that helped you.
__Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy , can you delete an item from the array? Say I am looking for cars, get(0) = BMW; get(1) =Audi and get(2)=Boing, so I want to delete the last one and if I make split().size to receive 2 instead of 3. Can this be done? Cheers, Nikola
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nikola Gaydarov -- Welcome to the Atlassian Community!
I have not tried that, and...
You could probably use match() with a regular expression to expand the other values into a new list/string, and then reform the list, either directly or with join().
You could also try using smart value list filtering to create a new list be removing the non-matches.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill, thanks a lot. If possible please check this thread.. https://community.atlassian.com/t5/Jira-Software-questions/Automation-Check-assignee-access-to-Confluence-page/qaq-p/2063864#U2070439
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.