Constraints in Rules

So i have this rule where one of the actions needs to check a ticket tag value and execute accordingly.

Its an Automation Command Executed rule.

Without the Show message constraint, it works perfectly, and shows the correct Value of the Tag.
There are only 2 possible values to this tag: Yes / No. With the constraint, it seems its always false.

Can i not use this tag check with an automation command executed rule?
because i have implemented the exact same thing for another tag, but the rule is on Ticket tag update. that one is working perfectly, and uses 4 different values, not just 2.

Currently im trying to get the show message to work so it shows the popup only when TAX Invoice tag is ‘Yes’. Eventually i’ll replace this action with a print action.

You cannot update something in one Action and then check it in another Action within the same Rule.

Action Constraints are evaluated at the same time when the Rule is loaded, and if an Action does not meet it’s Constraint, it is eliminated from the list of Actions.

Basically, the value of {TICKET TAG:TAX Invoice} might not be set when you enter the Rule, so the Show Message Action will be thrown out.

What you need to do is the split the Rule into 2 separate Rules, and place an Execute Automation Command Action in the first Rule.

So take the Rule you currently have, and remove everything after the Delivery Status Update, then place an Execute Automation Command Action immediately after it. Set the Automation Command Name to something like Deliverer Command - Ticket Print

Create another Rule for the Event of Automation Command Executed and set the Rule Constraint to:

Automation Command Name Equals Deliverer Command - Ticket Print

In that Rule, put your Show Message and Ticket Print Actions, and use your Action Constraints there, like:

'{TICKET TAG:TAX Invoice}' == 'Yes'

Be sure to quote both sides as shown above.

1 Like

Already tried that, didnt make a difference.

The Ticket Tag is set back when the ticket is created. And the show message without constraints is able to popup the right value.

Even when i created a new rule to shift all print jobs outside this, everything works perfectly, and show message without the constraint displayed the correct value. so i’m wondering why as soon as i use the constraint everything goes wrong.

It does make a difference. Don’t be fooled into thinking you can update something and then constrain following Actions based on the updated setting. It is bad practice, unpredictable, and completely unreliable. Don’t get into the habit of doing that. Separate your Rules if you want to do that sort of thing.

I cannot know for sure what the preceding Actions in your Rule are doing, so I assume they are updating a Deliverer Ticket Tag (or maybe assigning an Entity to the Ticket) and updating a Ticket State (perhaps named DeliveryStatus or the like).

Even so, the Ticket Tag will not have a value until the Ticket is Loaded (which is your first Action). So the message Constraint will always fail, and the message will not be shown. This is because upon entry to the Rule, the Ticket is not Loaded, and the constraint is testing against an empty Ticket Tag value, so it fails and the Message Action is “thrown out” before it even starts executing anything. In this scenario, this applies to anything that has to do with the Ticket, such as Ticket States, Ticket Tags, and assigned Entities.

So this is effectively how the Show Message Action Constraint is evaluating:

'' == 'Yes'


 and because of that the Show Message Action will not execute.

You must split your Rule into 2 Rules.

This is why, in a picture:


Show the Rule where that ^ happens.

Show a screenshot of the Message without the Constraint.

Put something in the message that is guaranteed to be shown, for example:

TktTagTaxInv: -{TICKET TAG:TAX Invoice}-
^^^^^^^^^^^^  ^                        ^
  even if the tag is empty/blank, those parts will show up.

Without that, the Show Message Action will not appear at all if the Message content is blank/null.

Ultimately, if splitting your Rule into 2 does not work, then something does not match
 something is set (or not) to some other value than you think it should be. Remember
 everything is case-sensitive.


I should have mentioned, there are other Print Tag values that are not known until the Ticket is loaded, for example:

{TICKET TOTAL}


 or any of these for that matter, so you cannot use them as Action Constraints within the same Rule:

2 Likes

Alright sorted it out using a completely different rule in the end. Triggered from Entity change as this example originally assigns the deliverer to the ticket.

So on deliverer change i was able to setup the rule with the conditions i needed and it works fine now. Thanks!