Custom JQL function for search issues workflow

Hi everyone,

Could you please advise how to get all issues and update newly created entity property for JIRA Cloud? And if my following solution (looping through all issues and update them) is the only one in this case? Because I’m afraid that performance in this case will be not so good.

Let’s say, that I would like to have a custom JQL function, which I can make via adding some information into Entity Properties based on the issues links.

But how better to add this information to all already existing issues?

Sure for future created/updated issues I can add a webhook that will add/remove this information, but how to make an initial step and check then update all issues at once? I’m afraid that it may consume a lot of resources and take a lot of time to process all of them, depending on the project size.

The workflow will look like this:

  1. Initial plugin setup: Get All Issues > Loop through them > Add/Update Entity Properties (via REST API) for every issue
  2. Later will add some webhooks on issues updates to make Entity Properties updates.
  3. After that, will create a new JQL function (alias) to search for these Entity Properties values.

Will be appreciate for any help.

Thank you in advance.

1 Like

That’s how we do it - you just have to be careful of a) permission to read/write to all issues and b) rate limiting your requests to Jira so you aren’t the cause of a Denial of Service attack on the instance.

Make sure you’re using the bulk set issue property endpoint. With it, you can actually set a property on all issues in just one request.

Just send:

PUT /rest/api/2/issue/properties/{yourPropertyKey} 

    "value": "your property value"

Dear @kkercz,

Thank you very much for your reply.

Regarding your comment, I’m wondering how may it be used here, if I need to check every issue, based on specific conditions and, then set entity properties values that will differ from issue to issue or even will be unique?

If I understood well “bulk set issue property” may create & set one property value for all issues at once. But if I need to set different properties values for different issues, then I have to loop through all issues and set them. Am I right?

Or do you mean to do something like this:

  1. Set default entity property value, like “not-set” for all issues, using bulk set issue property
  2. Then loop through all issues with “not-set” entity property value and update it with a real value, based on our conditions
  3. Use webhooks for any new created/updated issues, so they will stay up to date

Could you please give me at least one example how can I use it in our app?

Thank you very much for your help.


Dear @jbevan,

Thanks a lot for your advices, your app is really great!

For us we need a simple small add-on that will work with our projects and will create 2-3 additional filters only. However some of our projects have about 10K+ issues and it may become more. That’s why I’m afraid about performance and rate limit, as you said.

Could you please give me a little bit more information, what do you mean here?
Because first we need to get (read) all issues and then update (write) them. And then filter will give information, based on the permissions, individually for every user.

Thanks you in advance.



the API is flexible, in that it allows you to filter issues you are setting properties on. If you don’t provide any filter, it will just update the property on all issues. That was the example I showed, as I understood you wanted to set the same value on all issues during your initial setup.

But if that’s not the case, you have different options. The filter allows you to specify a list of issues to set the properties on, which would allow you to reduce the number of requests to just the number of different values you want to set (you would make one request per different value, grouping issues that should have the same property value). Another way of filtering is by the current property value, so that a new one is set only if the current value is equal to something specific. You can also set a property only if none has been set before (so you don’t need any special “non-set” value). Note that you can combine different kinds of filters to create more specific conditions.

It’s all described in the docs for this endpoint: /rest/api/2/issue/properties/{propertyKey}

If you can think of any other ways to filter that would suit your usecase, don’t hesitate to let us know, we might add them in the future!


You need to ensure that the user that is making the requests has global permission and project permissions also to view all issues and edit the too, otherwise your issue properties will only be added to some issues and the search results will be incorrect.

There is a permissions API you can use to check those permissions.

Dear @kkercz,

Thanks again for your support and answers. And sorry for bothering you with all my questions.

Unfortunately, if I understood right, filter options for “bulk set issue property” are limited only to issues that already have some properties or don’t have them at all, but when I need, for example, to get all issues with a specific issue link type, like duplicate or blocks, I will not be able to do that, using this endpoint.

That’s why in my case, during initial setup, I will have to loop through all issues and set/create this property individually for every one issue with different values, based on given conditions, like link type, etc.

And, maybe only then, when all issues will have these property values set, I will be able to filter & group them, by using this bulk endpoint.

Regarding that some of our projects have about 100K+ issues, initial setup may be time & resources consuming process, and I really wish to have & use some kind of bulk endpoint to do this job, it seems that this one will not work here.

But, unfortunately, I can’t find any other working solution in my case:

  1. Initially loop through all issues (without bulk endpoint) and create property with different values based on conditions (link type, etc.)
  2. Create webhooks to update newly created/updated issues
  3. Use bulk issues properties endpoint with filter to manage already existing property values

Perhaps I’m missing something, but it’s really not very simple to find any kind of information regarding this issue.

@kkercz, please advice if this is the only workaround here

Thanks in advance.


I think you got all that right, @Alexander. The issue property bulk update endpoint is only good for reducing the number of calls when setting issue properties, not for retrieving issues and figuring out what properties they should have.

Let me just suggest that you could use JQL for getting a list of issues that satisfy certain conditions. It would depend on what you exactly need, but perhaps dissecting the entire set of issues using into categories using JQL queries would be easier than fetching all issues and grouping them on your side.

To sum up, you can:

  • come up with a list of issue IDs to set a property on (how you do it is up to you)
  • pass on that list to the issue property bulk update endpoint to set the property in one call, instead of a separate calls for each issue

Using the bulk issue property endpoint is only an optimization (one I would strongly recommend at that), it won’t solve all your challenges, but should make your app more reliable.

Hope this clears things up.



Thanks again for your fast reply.

Unfortunately in my particular case, even with a powerful JQL, I can’t get a group of issues at once to make a bulk property value update, so I will have to fetch all issues and group them on my side.

That’s why I’m trying to build a plugin, because there’s no any JQL function to get a group of issues based on the link type, like “is blocked by” or “duplicates”.

The only JQL function you have is linkedIssues(), but it requires an issue key, so first I need to know the key to get all linked issues related to a given one.

issue in linkedIssues(ABC-123,"is duplicated by")

< product pitch>
I’m going to jump in here and shamelessly point out that ScriptRunner for Jira Cloud has such a property already. You can use hasLinks and linkType for example type = Improvement AND hasLinks = "relates to" or project = SALES AND issueLinkType = 'Blocks'

Full docs are here:

@jbevan knows all about this because he wrote the feature :wink:

</product pitch>

1 Like


Thank you very much for your answer

1 Like

Great discussion.

I’m trying to do something similar.

Is the best way to get all the issues initially by requesting them inside the ‘install’ lifecycle hook?

I’m having a problem requesting the issues initially as the addon without acting as the user. See my post here.

Thought you guys might have some insight.

Best Regards,

1 Like