It's all about the answers!

Ask a question

Validator javascript handler question

sam detweiler (12.5k6195201) | asked May 20 '13, 9:18 a.m.
edited May 20 '13, 10:15 a.m.
I have a couple custom fields on a workitem, which are workitem and workitemList types.

they function like I want them to, except for one item, I want to constrain the workitemtype allowed to be selected.
the add function brings up the 'pick any workitem (or create one)' dialog.

I know we cannot customize that (shame, would be SO easy with a couple optional properties for the presentation)

anyhow.. so I want to prevent saving if one picked the wrong workitem type.
but I don't think I can get access to this field contents (workitem or list) in javascript.
am I correct?

2 answers

permanent link
Ralph Schoon (62.9k33645) | answered May 20 '13, 10:15 a.m.
 Sam, you can get triggered by the work item type and potentially prohibit save, I think. The type as of is WorkItemAttributes.TYPE. If you validate to error and configure the operational behavior to prevent error level validation a from saving, you should be good. I have not tried that myself. I would probably rather go for a custom Advisor myself.

permanent link
sam detweiler (12.5k6195201) | answered May 20 '13, 10:26 a.m.
thanks.. my issue is that the linked doc says 'limited' types.. and the workitem and workitemList type fields are not listed..

and if its a list type, I need to run thru the list as well.

was thinking javascript so I wouldn't have to reboot the production servers. altho the osgi console should allow us to do that... another training exercise.

Ralph Schoon commented May 21 '13, 1:49 a.m.

Sam, I do believe your assessment that you can not access list type attributes in JavaScript is right. I would go for an advisor instead. (List type attributes return a list of objects). I don't think JavaScript is advisable here.

Your answer

Register or to post your answer.