There's no function to do this in Jira.
With Scriptrunner or your own code (I'm not sure other marketplace scripting or automation apps can support this), you could catch "worklog created" events, work out what was logged and simply delete it. If you did that, I'd strongly recommend feeding back to the person who logged it that you've killed their time log off.
However, I would not do this - both the delete and your idea of blocking scream of a broken process which needs fixing
If someone genuinley is working on something outside the sprint, stopping them recording that means that you are losing the information on what they were doing.
People will adapt to that if they have to. Imagine someone like me who has to account for 40 hours a week. If you force me to log all my time on active sprint items, then your data is going to be instantly useless, because I'm going to be forced to lie my way through the week.
You should not try to impose stuff like this, all it does is render your planning and reporting utterly useless. Go back to your people and find out why they might log time on stuff outside the sprint. Is it genuine? What are they really logging? Why? Why are the items they are logging on not in the sprint if they need to be done before the things that are?
During my 17 years as a coach, mentor, and trainer of Agile teams, I’ve participated in hundreds of Agile planning meetings. The end result was a wall of backlog items annotated by an explosion of co...
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