Default visibility on new card is set to All Users instead of current project team visibility
Hi,
I'm creating a new post for this as the existing post are almost 7-8 years old and there is no clear answer on how to do this :-)
The following assumes Youtrack 2018.1 is used, multiple projects with a specific team group per project are also there.
Creating a new ticket from an Agile board set the visibility of the card to "All users". My expectation is that the default visibility should be set to the project team (so no action from the user for each new card).
Is there a way to configure this? (hopefully an automatic configuration that matches the default visibility of each project to the default project team).
Thanks!
Stéphane.
Please sign in to leave a comment.
Hi,
Unfortunately no, cards are visible to All Users by default.
However, you can solve this problem with on-change workflow rule (https://www.jetbrains.com/help/youtrack/incloud/Workflow-Tutorial.html#tutorial-create-on-change-rule) which will run on issue creation and change its visibility settings.
You can catch issue creation via ctx.issue.becomesReported property in guard section. To change the visibility settings, please use ctx.issue.applyCommand("visible to GroupName") method (https://www.jetbrains.com/help/youtrack/incloud/v1-Issue.html#applyCommand).
Please let me know if it helps.
The exact code for the custom workflow to limit the issues visibility to the team members was specified here. The refined version including the option suggested by Anastasia is:
```
var entities = require('@jetbrains/youtrack-scripting-api/entities');
exports.rule = entities.Issue.onChange({
title: 'Limit default issue visibility to the project team',
guard: function(ctx) {
return ctx.issue.becomesReported;
},
action: function(ctx) {
//ctx.issue.permittedGroups.add(ctx.team); // Yieds exception
ctx.issue.permittedGroups.add(ctx.projnameTeam);
//ctx.issue.applyCommand('visible to MyProjName Team'); // Should work fine
},
requirements: {
projnameTeam: {
type: entities.UserGroup,
name: 'MyProjName Team'
}
}
});
```
PS It is weird that such a workflow should be created by a user and requires quite a lot of hassle instead of being provided by default once for everyone.
Thank you for sharing the code. We will consider adding this feature. Meanwhile, please feel free to upvote the corresponding feature request: https://youtrack.jetbrains.com/issue/JT-48951