Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Enforce usage of "Set to" of "Remaining Estimate" when logging work in project

Leonard Winck September 22, 2020

Hey there,

we've been tasked to enforce users in a specific project to set a value for "Remaining Value" -> "Set to" when logging work (both in WorkFlow-Functions and when logging work manually).

2020-09-22 12_24_28-Log Work_ BUF-2383 - pharma mall JIRA Test.png

I see two ways of accomplishing that:

  1. Enforce "Set to" by checking if value is larger than zero/null
  2. Enforce "Remaining estimate" in general and hide "Adjust automatically", "Use existing estimate of 0 minutes" and "Reduce by".

However, I wasn't able to accomplish that using native options. We do have ScriptRunner on our hand, so that's another possibility, if that value can be checked at all.

If anyone has an idea on how to built this, I'd be very thankful for your help.

1 answer

0 votes
Deleted user September 23, 2020

Hello there,

did anybody try this ? or have anyone an idea how can we go with this requirement? 

Also tried using Script Runner Behaviours which works well with TimeSpent if we set Initialiser or any code but it does not work with Remaining Estimate. Maybe someone have treid in that direction ?

Will be happy to get any lead. 

Thanks,

PreetiD

Leonard Winck October 6, 2020

Hey , @[deleted] I got this solved using ScriptRunner behaviours.

Just add a simple Behaviour and call it whatever you want. Map it to the project and eventually restrict the issue types it'll affect.

Insert the following code into the initializer:

def field = getFieldById("log-work-time-logged")
field.setDescription("""
<script>
document.querySelector('#log-work > div.form-body > fieldset > fieldset > div:nth-child(4) > label').click();

queries = ['#log-work > div.form-body > fieldset > fieldset > div:nth-child(2)',
'#log-work > div.form-body > fieldset > fieldset > div:nth-child(2)',
'#log-work > div.form-body > fieldset > fieldset > div:nth-child(3)']


for (idx in queries) {
element = document.querySelector(queries[idx]);
element.parentNode.removeChild(element);
}
</script>
""")

This will enforce the field "Remaining Estimate: Set to" by hiding all other options and selecting "Set to" as default. 

And that's it!

This script doesn't enforce a remaining estimate larger than 0, it just enforces that the field is not empty. So users will still be able to add 0 as remaining estimate, even if the issue isn't finished yet. Maybe you find a way to adjust that, if needed.

Have a nice day!

Deleted user October 6, 2020

@Leonard Winck thats great. I will give it a try :)

Like Leonard Winck likes this
Deleted user October 7, 2020

hey @Leonard Winck thanks for the script. Just to add. Its working in the log work screen but not in Transitions. So looking further if it can work through Behaviours also in Transitions. 

In Log Work Screen also it does not show that its required (*) on the screen but if we do not enter Remaining Estimate then it gives the error. That should work as of now but we can keep looking if its possible to show it required on screen.

Suggest an answer

Log in or Sign up to answer