Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Desired Behavior: An item of the type "test session" can only be moved to the state of "in testing" if the "assigned user" field is NOT empty
My current effort: I am trying to build a trigger which would check for an empty value in the "assigned user" My line of thinking was to create a logical field which would indicate if the field "assigned user" is empty. I was using the computation feature in this way: isEmpty("Assigned User",0) but the system complains of mixed types in the statement.
Integrity Admin Noobie here and would appreciate any help.
Thank You very much
Solved! Go to Solution.
Hi James,
the easiest way to ensure that a field is not empty when an item is switched to a new state is to set the field mandatory for the corresponding state.
Best regards
Markus
Hi James,
the easiest way to ensure that a field is not empty when an item is switched to a new state is to set the field mandatory for the corresponding state.
Best regards
Markus
Hi James Aguas,
Markus Kiessling's approach is probably the right one to take in this situation. By making the field mandatory in the state transition, it guarantees that the field has a valid value.
If you wanted to have your trigger do error checking, you can't just use isEmpty("Assigned User",0) because of the way isEmpty(arg1, arg2) works. If arg1 is not an empty value, it's returned. If arg1 is an empty value, arg2 is returned. They have to be the same type. Since 0 is an integer value and Assigned User is a user field, they're not the same type. Further, isEmpty(...) has to be of type numeric, time, or Boolean (Logical).
What should work for your computed field would be a computation along the lines of SelectionCount("Assigned User")>0, which shows how many selections have been made for Assigned User. This would be useful for error checking, but is not shown until after the edit is committed, while setting the field as mandatory for a state transition makes this clear to the user before the edit can be committed.
Let us know if that helps, or if you require more information.
Regards,
Kael
Thanks much Markus and Kael.
Markus' was a great suggestion and thank you Kael for your well written explanation for how to better set-up the trigger. Selection Count will be very useful for me.
Much appreciated,
James
From my perspective the easiest way is to use functionality "Constraint" within the Type definition.
There you only need to set a rule definition like this: