Hi
I would like to get the Attachment HTML section of a specific issue in script
is there a way to retrieve the issue HTML using scriptrunner?
thanks
Dar
I'm not sure what you mean by "the attachment html section", but I will guess that what you mean is "the displayed panel headed attachments when I look at an issue"
That is generated when you view the issue, not stored, so there's nothing to "get". If your script needs to use the raw html of that panel, it's going to have to replicate the logic that generates it all.
Hi Nic,
I would like to display the parent attachment section on the sub task issue as a script field that take the parent HTML and returns the attachment element
thanks
Dar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, a scripted field supports html output, so you can embed a lot of the table html you need in there. Then your script will need to grab the parent issue from the current one, and iterate through the attachments on it to get the details from them.
You'll also want to write a listener that can catch attachment updates from the parent issues and trigger a re-index on the sub-tasks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nic
maybe I didn't explained it right
I would like to do something like this:
We have 2 issues 139 (parent) and 140 (sub)
and I would like to show the parents attachment under the sub issue using script field
is it possible?
thanks!
I Capture-attachment field.PNG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Er, that's what I specified.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nic
I actually tried to write a script that get the HTML of the issue but the script seems to get into infinite loop or something and don't return anything
if I change the URL to some general url (www.google.com for example) i can get the HTML
why is that?
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; String url = "http://localhost:8080/browse/TEST-11/"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); String userCredentials = "user:pass" ; String basicAuth = "Basic " + new Base64().encode(userCredentials.getBytes()); con.setRequestProperty("Authorization", basicAuth); int responseCode = con.getResponseCode(); BufferedReader input = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = input.readLine()) != null ) { response.append(inputLine); } input.close(); return response.toString()
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to stop thinking in terms of "getting the html" and build it for yourself. If you try to fetch from the same place, you've put yourself into an infinite loop.
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.