cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How do I check for an empty "assigned user" field for bulding a rule?

jaguas
2-Explorer

How do I check for an empty "assigned user" field for bulding a rule?

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

ACCEPTED SOLUTION

Accepted Solutions
mkiessling
12-Amethyst
(To:jaguas)

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.

  • edit item type "Test Session"
  • select "Workflow"
  • select the state "In Testing"
  • on the right side in the window "Mandatory Fields" select activate "Assigned User"

Best regards

Markus

View solution in original post

4 REPLIES 4
mkiessling
12-Amethyst
(To:jaguas)

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.

  • edit item type "Test Session"
  • select "Workflow"
  • select the state "In Testing"
  • on the right side in the window "Mandatory Fields" select activate "Assigned User"

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


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager
jaguas
2-Explorer
(To:mkiessling)

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

khoppe
15-Moonstone
(To:jaguas)

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:

Announcements


Top Tags