Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Restrict Time Spent if subtask available

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

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

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)

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

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?

@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)

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

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you