It's all about the answers!

Ask a question

RTC workitem making boolean attributes mandatory


Kunal N (872862) | asked Oct 03 '17, 7:54 a.m.

 Hi All,


I need to make boolean tye attribute as a required feild in RTC for a particular state. I know there is a precondition(Operation behavior) available however in that there we don't get the attributes with type as boolean.

I have a customized workitem and a attribute which is kind of checkbox, I need to make the checkbox mandatory for a particular state.

Thanks
Kunal.

Accepted answer


permanent link
Luca Martinucci (1.0k397112) | answered Oct 03 '17, 10:00 a.m.

I suppose that the problem with making checkboxes mandatory is that they have always a value, i.e. "false" when they are not checked and "true" when they are.

You'd better define a different attribute, or write a precondition on WorkItemSave that reads the value of the attribute and returns an error if it is "false".

Kunal N selected this answer as the correct answer

Comments
Kunal N commented Oct 03 '17, 11:38 a.m.

 Thanks for your response Luca.


What if I use a radio button instead of a checkbox with two options. I need to find a way to achieve this without writing a precondition altogether.

Thanks
Kunal


Ralph Schoon commented Oct 04 '17, 4:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 The presentation does not make a difference. A boolean value is always set and there is no unassigned. So mandatory does not make any sense for boolean attributes. 


Also writing a custom extension will not help as it also can not detect if the attribute was manually set.
 
Lucas and Donalds suggestions to use a different attribute that can be unassigned and has two values resembling true and false is the only viable solution here.


Luca Martinucci commented Oct 04 '17, 4:16 a.m.

Use an enumeration attribute, maybe with just the "true" value.
This way, if the attribute is "unassigned" the mandatory condition will raise a validation error.
By explicitly setting it to "true", the condition will no longer raise any error.


Kunal N commented Oct 05 '17, 10:42 a.m.

 Hello Luca,


As suggested by you, if we use a enum attribute with only true and unassigned value how can i achieve following:

Suppose I setup enumeration with values as true and assigned then I need to set a condition such that whenever the workitem is in a state "X" it should move to state "Y" only if the enumeration value is selected as "True " by the user.

Thanks
Kunal N


1
Luca Martinucci commented Oct 06 '17, 8:55 a.m.

Kunal,
when you define the enumeration for such an attribute, specify that the Unassigned" (or whatever string you like) value is set as both the Default Literal and the Unassigned Literal.
Then, you must set the attribute as mandatory in state "Y".
If the user who is moving the work item from X to Y has not set the attribute value to "True" the mandatory attributes precondition will raise a validation error.


Kunal N commented Oct 06 '17, 10:16 a.m.

 Thanks for your help Luca

showing 5 of 6 show 1 more comments

One other answer



permanent link
Donald Nong (14.5k614) | answered Oct 03 '17, 9:28 p.m.

An alternative is use an enumeration with values "true" and "false". When you don't pick either value, the attribute is "unassigned".


Comments
Kunal N commented Oct 05 '17, 10:38 a.m.

 Hi Donald,


If I go by the way you are suggesting, then How can I achieve following scenario:

Suppose I setup enumeration with values as true, false and assigned then I need to set a condition such that whenever the workitem is in a state "X" it should move to state "Y" only if the enumeration value is selected as "True " by the user.

Thanks
Kunal N

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.