You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi,
I got this sample from here, https://scriptrunner.adaptavist.com/4.3.5/jira/behaviours-conversions.html
Code snippet from the url :
def repoNames = repos["items"]*."full_name"
rt = [
items: repoNames.collect { String repo ->
[
value: repo,
html : repo.replaceAll(/(?i)$query/) { "<b>${it}</b>" },
label: repo,
]
},
total: repos["total_count"],
footer: "Choose repo... (${repoNames.size()} of ${repos["total_count"]} shown...)"
]
Json:
"id": 76954504, "node_id": "MDEwOlJlcG9zaXRvcnk3Njk1NDUwNA==", "name": "react-tetris", "full_name": "chvin/react-tetris", "private": false, "owner": {
As you can see it's getting the "full_name" but I want to combine let say "full_name" and "node_id". So the output would look like "chvin/react-tetris MDEwOlJlcG9zaXRvcnk3Njk1NDUwNA==" Does anyone know how I can achieve this from the code?
Thanks!
This line does an implicit collection of all the "full_name" from all the items (that's what the * does).
def repoNames = repos["items"]*."full_name"
So instead, just do your own collection:
def repoNames = repos["items"].collect{"${it."full_name"} ${it."node_id"}"}
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.