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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Mandatory fields when certain conditions are met

ptc-5150641
1-Newbie

Mandatory fields when certain conditions are met

I know the best way to make a field mandatory when certain conditions are met is to use a pre-event trigger. However, my dilemma lies that I have mandatory fields in the same state, in two tabs, and one is hidden (due to an earlier mandatory field in a state). Now, I do not want the fields that are mandatory on the hidden tab to be mandatory anymore because a different condition was met. Is the best way to run multiple pre-event triggers to make the fields mandatory instead of making them mandatory in the workflow? Also, what order are the pre-event triggers executed?

4 REPLIES 4

I should also mention some fields are relationship fields that need to contain at least one related item.

Hi Anthony,

Depending on your Integrity version, you might want to take a look at the "Constraints" functionality. While it is not as powerful as a pre-event trigger (where you can check group membership, fire on specific state or field transitions, check the field values on items on the other side of relationship fields, etc), it does allow you to make fields mandatory based on the field values currently selected in the item, not just the state workflow.

This has allowed us to remove multiple triggers (which merely fired an abort if the rule was matched) and consolidate our mandatory fields logic to make it easier to maintain. It also makes the field labels turn red and show up in the "mandatory fields" hover in the corner of the item, which is appreciated by our users.

I can't seem to find a reference for how it works in the knowledgebase, but if you look at the "Managing Constraints" section (under Item Type Attributes) in the Server Administration Guide, it goes over how the constraint functionality works and how you implement constraints on your item. Your use case sounds like you are looking for a "rule" constraint.

Hope that helps,

Matt

Matt, I am currently using 2009, unfortunately I do not have the ability to setup constraints.

:S

In that case, you will want to use the pre-event triggers.

The rule based triggers execute in the "position" order, from lowest to highest, so you can re-order the triggers to get the proper functionality.

You could set up individual triggers for each field that execute one after the other or consolidate them into a single trigger that runs all the validation logic.

The performance is usually better with several rule triggers as the server can evaluate the rules to determine which trigger to execute faster than it can process the same set of logic as if/else statements in the trigger script itself.

Hope that helps,

Matt

Top Tags