It is possible to restrict an a Jira worklog attribute for only specific types of issues, projects or users. You can do this by using a JSONata expression. Although JSONata can query a JSON document and return arrays, strings, object, for the scope of applicability checks, you need to return a Boolean value. If the returned value is true, attribute will be displayed, otherwise it will not be displayed.
...
You can find some example statements below, if you need help to write your expression, you can always request our help.
Check Project
This example checks for a specific project using the key of the project.
Code Block |
---|
issue.fields.project.key = "My Jira Project" |
Check Project Category
This example checks whether the project’s category name is “External”. You can also check category “id” instead of name by replacing “.name” with “.id” and using the actual category id.
...
Code Block |
---|
$boolean($filter(user.applicationRoles.items.key, function($v) {$v = 'jira-servicedesk'})) |
...
Code Block |
---|
$boolean($filter(user.groups.items.name, function($v) {$v = 'jira-administrators'})) |
Check Current Issue Type
The following expression only allows Jira worklog attribute if issue type is either Story or Epic.
Code Block |
---|
issue.fields.issuetype.name in ["Story", "Epic"] |
Check Issue Doesn’t Have Subtasks
The following expression only allows Jira worklog attribute if issue doesn’t have any subtask. You can easily reverse the expression by using “!=” instead of “=”.
Code Block |
---|
$count(issue.fields.subtasks) = 0 |