Is there a way to modify the "attachments is not EMPTY" filter to return the projects that have attachments? The filter above works fine, but it returns all issues with an attachment, which for our Jira implementation is over 170K. We have less than 1000 projects, and I'm trying to constrain the result to just the projects with attachments.
FYI- I have ScriptRunner if that helps.
Regards - Steve Janvrin.
Hey
I'm Reece, one of the engineers on the ScriptRunner team, it's nice to hear you're considering using ScriptRunner to achieve this.
As @Florian Bonniec noted, our new HAPI scripting syntax would be ideal for this, HAPI is available in ScriptRunner 7.11.0 and later.
If I have understood the requirement correctly, you want a list of all projects where attachments are present?
The simplest script I can think of would be to run the JQL query, then collect all relevant project keys. This will be a bit slow on a large dataset, if this is something you need to do a lot, other more complex options may be better suited.
Luckily, with the power of HAPI, such a script is super simple:
import java.util.stream.Collectors
Issues.search('attachments is not EMPTY').stream()
.map { issue -> issue.projectObject.key }
.collect(Collectors.toSet())
HAPI processes JQL searches in batches, so you need not worry that the above script will consume a large amount of memory. I've also used Java streams to process the results, again this is to optimise memory consumption.
Hopefully HAPI can help you achieve what you need.
https://www.scriptrunnerhq.com/hapi
Cheers!
JQL return issues only so you cannot use it to return Projects. What version of scriptrunner do you have ? If it' 7+ version you may create a script using HAPI to do that.
You can do a script whatever the version you use but HAPI will be easier if you are not confident with developement.
Regards
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.
Hi,
You can create a script with scriptrunner to achieve this. You will not be able to do it with JQL unless you willing do to it project by project in the JQL.
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.
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.