It's all about the answers!

Ask a question

EWM 7.0.2 - Best way to limit hours estimate across whole tool UI


Glyn Costello (1402354) | asked Jul 12, 7:03 a.m.

Hi all 


Can anyone recommend the best way to limit the amount of hours estimated against a single task that will work across the different UI elements? i.e. if someone is entering hours in a plan view, or in a standard work item view, or in quick planner, etc. 
e.g. Work Item save won't work if the execution work item estimate is greater than 80 hrs. 

Thanks, 

Glyn

2 answers



permanent link
Ralph Schoon (63.4k33646) | answered Jul 12, 8:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jul 12, 8:09 a.m.

Hi Glyn,


if you refer to the work item attributes estimate, corrected estimate, the only consistent solution I could come up with would be a pre-condition/advisor extension that prevents a work item save in case the attributes have undesired values.


permanent link
Davyd Norris (2.6k217) | answered Jul 12, 11:08 p.m.
I agree with Ralph - I would use a Validator in the Work Item Attribute Customisation and then attach it to the Estimate attribute. The Estimate attribute is of type Duration so you will need to create a Script based Validator as the built in decimal or integer ones can't be attached to the field.

Something like this will work. Duration is returned in milliseconds, so you'll need to multiply by an appropriate factor - I've made the maths explicit below:

dojo.provide("com.example.estimateTooBig.Validator");

dojo.require("com.ibm.team.workitem.api.common.Severity");
dojo.require("com.ibm.team.workitem.api.common.Status");

(function() {

const Severity = com.ibm.team.workitem.api.common.Severity;
const Status = com.ibm.team.workitem.api.common.Status;

    dojo.declare("com.example.estimateTooBig.Validator", null, {
        validate: function(attribute, workItem, configuration) {
            return parseInt(workItem.getValue(attribute)) < (80 * 60 * 60 * 1000) ?
              Status.OK_STATUS :
              new Status(Severity["ERROR"], "That's way too big!!");
        }
    });

})();

Once you have attached the validator to the Estimate, you will also need to go into the Operation Behaviour section and add the Attribute Validation precondition in order for the validator to be evaluated and the error thrown upon Save

PS: You need to use the EWM Eclipse Client to do this

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.