currentUser() broken in structure

Dan Moditch July 19, 2019

FYI

currentUser() seems to reference the user that created the structure not the user logged into the session looking at the structure.

One of my developers needed a structure to list issues she was watching. i created a folder and added a an insert JQL [ watcher = currentUser() ] this populates the structure with tickets I am watching when she uses the structure. We created a new structure with the same query from her machine and it brings in her watched issues.

Is this behavior as designer or is this a bug?

4 answers

0 votes
Nathan Packard November 22, 2022

I have the same problem, but transformations doesn't resolve it.

I am trying to embed a structure into a Jira dashboard to show employees the tickets assigned to them.

currentUser() only shows my issues (the structure creator).

transformations are not respected in the structure jira dashboard widget.

Is there any way I can embed a structure into a jira dashboard that shows only the tickets assigned to currentUser()?

0 votes
daniel.britschgi November 20, 2020

Hi,
I have a similar request. I would like to filter for issues assigned to the logged in user for a specific hierarchy level:
structure_currentUser.png

But this works only for me, becaus the filter runs only under my name. I would like to have the filter for each user. So, the filter should run under each user which is logged in and using the structure. Is this not possible?
In the result I would like to see only my PRJs, but all issues inside the PRJs. If there is another way, please let me know.

Stepan Kholodov _ALM Works_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 20, 2020

Hello Daniel,

The described can be done using a Filter transformation:

1. 1. Click the 'Automation' button.
2. Click the 'Transformations' button and then Add transformation on the appeared panel.
3. Select Filter | S-JQL Query... and type: selfordescendant of[assignee = currentUser() and type=prj] where prj is the PRJ issue type's name.
4. Save that transformation and it will be available for all users to turn on and for each user it will show only PRJs(and their sub-issues) assigned to them personally.

Best regards,
Stepan Kholodov
ALM Works

daniel.britschgi November 20, 2020

Hi Stepan,

Ok for structure it works. Thx. But only via transformation. It is not possible to filter all issues via "issue in structure(151)" because the transformation will not impact the result in the filter and the whole structure.

Regards

Daniel

0 votes
Stepan Kholodov _ALM Works_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 28, 2020

Hello Dan,

Our apologies for not answering you sooner, for some reason we didn't get a notification about your post. The currentUser() function can't work as expected when it comes to using it in generators - generators always run from under their structure's owner and this user stays the same regardless of who is accessing the structure. The function can be successfully used in the Filter transformation - then the structure will be first built from under its owner and then its content will be filtered out to display only issues that are assigned to a viewing user.

Please feel free to contact us at support.almworks.com if you need help with using transformations or if you have questions about anything; if you create a request, we'll get back to you shortly.

Best regards,
Stepan Kholodov
ALM Works

Björn Samland October 21, 2020

Hi, 

that´s not resolving the problem. 

What I want to achieve is: 

Every user can use the same structure to see all tasks assigned to him. I can´t put a generic structure in to select 80k+ tickets and then transform it. Seeing the performance of this, that´s totally ineffective...

 

Regards

Stepan Kholodov _ALM Works_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 21, 2020

Hello Björn,

As an alternative, you can try the following:

1. Open any structure and select the JQL option in the selector in the top left corner. This will switch to the JQL search mode instead of showing you any actual structures.
2. Type the same query as you have right now for the Insert generator but with the addition of the currentuser() function. This will show all issues of a current user that you want to be loaded in the structure.
3. Then, if you also have any hierarchy going on in the structure, you can recreate it in the JQL view as well by using transformations - Extend transformations for adding linked issues, Group transformations for grouping etc.
And once you recreate the structure you want to see there, you can click the Share button in the top right corner and send it to users so they could acces Structure using this link instead of opening the actual structure. The link will lead them to same view as you created in the JQL search, including applied transformations.

The idea here is to avoid creating an actual structure in the first place to also avoid the loading of a large number of issues before the filtering. Instead, a needed scope of issues is loaded in the search results and then additionally transformed to look like a structure. This workaround can be used by other users, they just need to access Structure using the perspective link.
JQL_perspective.jpg

I hope this helps. If this is not the fitting solution, please contact us directly at support.almworks.com and we'll be glad to look at your current structure and see what can be done to limit the initial loading of issues.

Best regards,
Stepan Kholodov
ALM Works

Like Dave Rosenlund likes this
Björn Samland October 21, 2020

Hi,
sorry, nope this isn´t helping. I want to provide employees with a simple predefined list of their tasks, using structure. I don´t want everyone having to retype that JQL Query every day.
I suggest you provide an attribute that can be used in the JQL Insert that relates to the actual current user. I personally find it extremely misleading that the current user in this context is the owner of the structure. There´s gotta be a way to bypass that... as the owner isn´t necessarily the currentUser especially in cases where we want to provide simple structures for many users.
Kind regards

Like Daniel Britschgi likes this
Stepan Kholodov _ALM Works_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 22, 2020

The described workaround only needs to be configured once by one user - when the Perspective link is created, it would only be required for other users to open it, and they will see issues that are assigned to them with all of the enabled transformations. The currentUser() function limitation is only related to generators, it works the same as expected in transformations and in the JQL search.

Your use-case absolutely makes sense and we definitely agree that the limitation can be inconvenient, but, unfortunately, it's not something that we can overcome simply and without changing the current architecture of Structure. But we're looking for ways of how this can be addressed in the future.

Right now only workarounds can be used. If you're looking for a different approach, we'll be glad to look into your set-up closely and come up with another solution that would apply, if possible. So please feel free to email directly to support@almworks.com and we'll get back to you shortly.

Best regards,
Stepan Kholodov
ALM Works

0 votes
Anar Chipur August 28, 2020

I have the same problem

1. I created a structure with a filter as in the screenshot below (the assignee is set to currentUser())

2. I created a Dashboard with a gadget that references this structure; it works for me - I see the structure contents; however if another user opens the same dashboard, she sees not her contents but mine - this is the problem 

Any idea?

structure-currentUser.png

Stepan Kholodov _ALM Works_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 28, 2020

Hello Anar,

When it comes to structures, built automatically, generators that add issues always run from under the structure's owner, i.e. the currentUser() function can't work here as expected. If a generator's query is changed according to a user who is accessing a structure, it might cause some mix-ups - a structure itself might look differently for all users and some issues might be unavailable unintentionally. And if a structure is opened by several users at once, it would need to generate according to users' permissions and it might create additional strain on the performance.

For cases when a structure needs to be displayed differently for different users, transformations can be used - they are easy to apply and they only change the structure for a specific user in its browser window. So for structures, accessed by the majority of users, we would recommend to build them by a user with access to all of the needed issues and then to use transformations for additional filtering, grouping, etc. You can learn more about this feature in our documentation: https://wiki.almworks.com/display/structure/Using+Transformations

In your case, the Filter transformation by Assignee can be used after the structure is opened. For that please do the following:

1. Click the 'Automation' button to disable the Generators' editing mode (turning on or off of this button doesn't change anything in a structure).
2. Click the 'Transformations' button and then Add transformation on the appeared panel.
3. Select Filter | JQL Query... and type: assignee=currentUser().
4. Save that transformation and it will be available for all users to turn on (to access saved transformation, please click the 'Quick transformations' button).

I hope this helps! Please feel free to contact us directly at support.almworks.com if you need further assistance.

Best regards,
Stepan Kholodov
ALM Works

Suggest an answer

Log in or Sign up to answer