Standard Condition + Custom Condition

I’m confused about combining conditions and can’t seem to find a clear answer in the docs or in this forum.

It seems to work in the UI (v5) to set the dropdown condition to a standard one (“On Correspond” in my case) and the action to a standard one (“Notify AdminCC” in my case) AND add code for a Custom Condition. The standard condition and the custom must both be true for the action to fire.

This all makes sense, but the UI has a disclaimer above the custom fields that reads: (Use these fields when you choose ‘User Defined’ for a condition or action). That makes me think what I’m doing above is not supported, and I see advice here indicating that.

Is the above OK, or am I supposed to set the dropdown condition to “User Defined” and preface my existing custom condition code with:

return 0 unless $self->TransactionObj->Type eq "Correspond";

Apologies if this has been asked before (it must have been somewhere) and thanks in advance for your advice.

Jason

You can either choose a predefined condition or write your own custom condition and in this case you must select UserDefined.

If you wan’t to combine an existing condition and extend it with other rules, you would better write a local/lib/RT/Condition/MyCondition.pm for this and makes it based on the exiting one with something like use base 'RT::Condition:XXX'.

For simple cases, like basing your custom code on On Correspond standard condition, yes, it’s as easy as using a UserDefined condition starting with the line you proposed :slight_smile:

1 Like