JQL Functions for connect

When the precomputation is sent to an app to evaluate a custom function, will the clientKey or accountId also be provided? The docs refer to the precomputationId in the input but does not refer to anything that would identify the client who made the precomputation request.

JQL Functions docs

I understand that it is not scoped to users as per the docs, however to process the JQL fragment for the response we would need to identify the client who has sent the request.

Hi @JasminBateman, thank you for reaching out!

It’s important to remember that precomputations are stored in a “global context”. If two users execute the same query (the same function call), we will utilize the same precomputation. In other words, your app won’t be invoked for the second time.

What does it mean in practice? Let’s imagine you process JQL function logic in the context of the 1st user. The result returned by your function (JQL fragment) is stored as a precomputation and shared by other users who will call this function with the same arguments. This is why we don’t pass clientKey/accountId within an input object.

If you need to differentiate the behavior of the function based on the user, there is an option to add a dedicated argument, for example:

issue in issuesImportantTo("user-id")

We also describe this here:
https://developer.atlassian.com/cloud/jira/platform/jql-functions/#precomputations-and-users

Best regards,
Ɓukasz

2 Likes

Thank you :+1: