If you have ever tried the Require User to Log Work Before Transitioning Issue tutorial, you will see how to force a user to log time if they have never logged time to an issue. But what if you want users to log time before EVERY transition? If you would like to know how, read on!
Background
Using Live Fields, we can force users to enter time based on what they enter in the "Time Spent" field no matter what. This method builds on the Validating Custom Fields page. The code found in the "Validating a Custom Field in the Edit Screen" section is very similar.
Main Script
lfInstantHook("timeSpent", "LiveFields/hook.sil"); lfWatch("timeSpent", "timeSpent", "LiveFields/hook.sil"); |
Hook Script
if (argv["timeSpent"] == "") { lfShowFieldMessage("timeSpent", "Hours logged cannot be empty", "ERROR"); lfDisable("transitionSubmit"); } else { lfHideFieldMessage("timeSpent"); lfEnable("transitionSubmit"); } |
Here is what the validator looks like in action:
Additional Help
Need help implementing this script? Talk to me directly to me by clicking on the bot on this page.
Related articles
Filter by label
There are no items with the selected labels at this time.