Dear Community,
It seems to me that it is only possible to request the Jira API from a JQL function with asApp()
, not with asUser()
(the latter results in an HTTP 401). This means that I cannot use /rest/api/3/myself
for getting the ID of the user executing the JQL function, as this returns the technical user of the Forge app.
Is there any way to get at least the ID of the currently logged in user in a JQL function context?
The use case would be the following: I have a JQL function, one of its parameters is a User. As such, it would be convenient to be able to use nested queries that resolve to a User - most obviously ācurrentUser()ā. Even if we cannot execute an entire JQL user clause from a user context, manually checking whether ācurrentUser()ā was entered in place of the User argument, would immensely improve the functionās usability.
Now that I think of it a bit moreā¦ it seems to me that since Jiraās JQL function precomputation cache does not store the executing user as a key: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql-functions--apps-#api-rest-api-3-jql-function-computation-post , this architecture doesnāt allow for any JQL function which produces different results depending on the user context. Iām afraid this pretty much answers my question. This means, however, that there is an inconsistency between complete JQL queries and (Forge) JQL functions, since the former can produce user-dependent results, while the latter cannot. Does anybody know a workaround?