Restrict Time Spent if subtask available

Omprakash Thamsetty
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 22, 2021

Hi,

 

Is there any way we can restrict entering the time in parent issue ? I would like to time spent restrict, if subTask available.

We can use in workflow by entering the below property value but it will disable completely. It will not check for subTask available or not. 

jira.permission.work.denied

We need to allow if there is no subTask for issue. 

 

Any advise.

 

Thanks,

Om

2 answers

2 accepted

1 vote
Answer accepted
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 23, 2021

You can try using the "Hide System or plugin UI Element" script fragment.

2021-06-23 17_08_15-Fragments.png

0 votes
Answer accepted
Omprakash Thamsetty
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2021

Hi @Peter-Dave Sheehan Thanks you for the reply.

  I tried with the following condition. I am specifying the project and issue type to narrow down the condition but it is not working. Log work is still visible and accepted logging the hours even subTask available or not.   

  If the user story has subtasks then log hours shouldn't be accepted at user story. 

 

(jiraHelper.project?.key == "JIRAPOJ" && issue.issueType.name == "User Story" && issue.subTaskObjects.size() > 0)

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 24, 2021

The condition block in the "hide system or plugin ui" does not specify when you want to hide the item. It specifies when you want to show it.  So you want to return True most of the time and False, when you want the item to be hidden.

Right now, you are returning True on a specific project when the issue has subtask.

It will be hidden for all other projects and situations. So you should put a ! before your parenthesis.

But also, I missed one item  in the "Hide waht" (because it was disabled in my environment)... you need the following 2:

  • com.atlassian.jira.plugin.system.issueoperations:log-work
  • com.atlassian.jira.jira-view-issue-plugin:create-worklog

The first hides the menu item in the issue More menu. 

The second hides the + sign on the time tracking panel on the right

Omprakash Thamsetty
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2021

Hi @Peter-Dave Sheehan I agree to keep ! before the condition and I have added log-work to disable from more menu. Even though it is not hiding log work option

 

fragment.PNG

 

!(jiraHelper.project?.key == "OP" && issue.issueType.name == "User Story" && issue.subTaskObjects.size() == 0)

 

Is anything wrong in my condition?

Omprakash Thamsetty
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2021

@Peter-Dave Sheehan 

Look like I figured it out the condition. I used following condition to make it work. Thank you so much Peter for your help on this. 

!(jiraHelper.project?.key == "OP" && issue.issueType.name == "User Story") && !(jiraHelper.project?.key == "OP" && issue.subTaskObjects.size() == 0)

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 24, 2021

I think you can clean up that condition ... try this:

jiraHelper.project?.key != "OP" ||
  issue.issueType.name != "User Story" ||
 issue.subTaskObjects.size() == 0

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.13.4
TAGS
AUG Leaders

Atlassian Community Events