Validator to check and throw an error message when Time Spent attribute value is greater than Estimate attribute value
![]()
Hello Team,
We need an error message to be triggered when the Time Spent Value is entered greater than the Estimate/Correction Value and the WI should not be allowed to Save.
I tried writing a script to implement this validation but it is not working as expected. It is not validating the condition when time spent is greater than estimate and throwing the error message irrespective of the value in time spent.
(Version: 7.0.2)
Could you please help and let me know if I'm missing something?
dojo.provide("com.bosch.rtc.js.client.workflow.timevalidator");
dojo.require("com.ibm.team.workitem.api.common.Severity"); dojo.require("com.ibm.team.workitem.api.common.Status"); dojo.require("com.ibm.team.workitem.api.common.timeSpent"); dojo.require("com.ibm.team.workitem.api.common.duration"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); (function() { var doDebug = true; Status = com.ibm.team.workitem.api.common.Status, Severity = com.ibm.team.workitem.api.common.Severity, timeSpent = "timeSpent", estimate = "duration", WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes, dojo.declare("com.bosch.rtc.js.client.workflow.timevalidator", null, { validate: function(attribute, workItem, configuration) {
if((timeSpent==estimate)&&(timeSpent<=estimate)){
return Status.OK_STATUS; } else { return new Status( Severity["ERROR"], " Time Spent value is greater than the Estimate. Please correct the Estimate value."); } } }); })();
Thanks in advance.
|
Accepted answer
![]()
Ralph Schoon (61.8k●3●36●43)
| answered Jul 14 '22, 2:43 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Several suggestions.
Divya _ selected this answer as the correct answer
|